• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_HIVIEWDFX_QUERY_SYS_EVENT_CALLBACK_PROXY_H
17 #define OHOS_HIVIEWDFX_QUERY_SYS_EVENT_CALLBACK_PROXY_H
18 
19 #include "iquery_sys_event_callback.h"
20 
21 #include <cstdint>
22 #include <functional>
23 #include <string>
24 #include <vector>
25 
26 #include "iremote_broker.h"
27 #include "iremote_object.h"
28 #include "iremote_proxy.h"
29 #include "nocopyable.h"
30 #include "refbase.h"
31 
32 namespace OHOS {
33 namespace HiviewDFX {
34 class QuerySysEventCallbackProxy : public IRemoteProxy<IQuerySysEventCallback> {
35 public:
QuerySysEventCallbackProxy(const sptr<IRemoteObject> & impl)36     explicit QuerySysEventCallbackProxy(const sptr<IRemoteObject>& impl)
37         : IRemoteProxy<IQuerySysEventCallback>(impl) {}
38     virtual ~QuerySysEventCallbackProxy();
39     DISALLOW_COPY_AND_MOVE(QuerySysEventCallbackProxy);
40 
41     void OnQuery(const std::vector<std::u16string>& sysEvent, const std::vector<int64_t>& seq);
42     void OnComplete(int32_t reason, int32_t total, int64_t seq);
43 
44 private:
45    void ClearAllAshMemories();
46 
47 private:
48     static inline BrokerDelegator<QuerySysEventCallbackProxy> delegator_;
49     std::vector<sptr<Ashmem>> allAshMemories;
50 };
51 } // namespace HiviewDFX
52 } // namespace OHOS
53 
54 #endif // OHOS_HIVIEWDFX_QUERY_SYS_EVENT_CALLBACK_PROXY_H
55