Home
last modified time | relevance | path

Searched refs:watcher (Results 1 – 25 of 58) sorted by relevance

123

/base/startup/init/interfaces/kits/jskits/src/
Dnative_parameters_watch.cpp57 ParamWatcher *watcher = nullptr;
63 ParamWatcher *watcher;
191 static bool GetFristRefence(ParamWatcherPtr watcher, uint32_t &next) in GetFristRefence() argument
193 std::lock_guard<std::mutex> lock(watcher->mutex); in GetFristRefence()
194 auto iter = watcher->callbackReferences.begin(); in GetFristRefence()
195 if (iter != watcher->callbackReferences.end()) { in GetFristRefence()
196 next = watcher->callbackReferences.begin()->first; in GetFristRefence()
202 static napi_ref GetWatcherReference(ParamWatcherPtr watcher, uint32_t next) in GetWatcherReference() argument
204 std::lock_guard<std::mutex> lock(watcher->mutex); in GetWatcherReference()
205 auto iter = watcher->callbackReferences.find(next); in GetWatcherReference()
[all …]
/base/hiviewdfx/hisysevent/frameworks/native/c_wrapper/source/
Dhisysevent_rust_listener.cpp27 HiSysEventRustListener::HiSysEventRustListener(HiSysEventRustWatcherC* watcher) in HiSysEventRustListener() argument
28 : watcher_(watcher) in HiSysEventRustListener()
57 void HiSysEventRustListener::RecycleWatcher(HiSysEventRustWatcherC* watcher) in RecycleWatcher() argument
60 if ((watcher == nullptr) || (watcher->status == STATUS_MEM_FREED)) { in RecycleWatcher()
63 if (watcher->status == STATUS_MEM_NEED_RECYCLE) { in RecycleWatcher()
64 watcher->status = STATUS_MEM_FREED; in RecycleWatcher()
65 delete watcher; in RecycleWatcher()
68 watcher->status = STATUS_MEM_NEED_RECYCLE; in RecycleWatcher()
Dhisysevent_rust_manager.cpp84 int HiSysEventAddWatcher(HiSysEventRustWatcherC* watcher, const HiSysEventWatchRule rules[], in HiSysEventAddWatcher() argument
87 if (watcher == nullptr || watcher->status != STATUS_NORMAL) { in HiSysEventAddWatcher()
95 auto listenerRust = std::make_shared<HiSysEventRustListener>(watcher); in HiSysEventAddWatcher()
103 …g_baseWatchers[std::make_pair(watcher->onEventRustCb, watcher->onServiceDiedRustCb)] = baseListene… in HiSysEventAddWatcher()
107 … g_watchers[std::make_pair(watcher->onEventRustCb, watcher->onServiceDiedRustCb)] = listenerRust; in HiSysEventAddWatcher()
112 int HiSysEventRemoveWatcher(HiSysEventRustWatcherC* watcher) in HiSysEventRemoveWatcher() argument
114 if (watcher == nullptr || watcher->status != STATUS_NORMAL) { in HiSysEventRemoveWatcher()
117 auto watcherKey = std::make_pair(watcher->onEventRustCb, watcher->onServiceDiedRustCb); in HiSysEventRemoveWatcher()
133 void HiSysEventRecycleWatcher(HiSysEventRustWatcherC* watcher) in HiSysEventRecycleWatcher() argument
135 if (watcher == nullptr) { in HiSysEventRecycleWatcher()
[all …]
Dhisysevent_c_wrapper.cpp101 int HiSysEventAddWatcherWrapper(HiSysEventRustWatcherC* watcher, const HiSysEventWatchRule rules[], in HiSysEventAddWatcherWrapper() argument
104 return OhHiSysEventAddRustWatcher(watcher, rules, ruleSize); in HiSysEventAddWatcherWrapper()
107 int HiSysEventRemoveWatcherWrapper(HiSysEventRustWatcherC* watcher) in HiSysEventRemoveWatcherWrapper() argument
109 return OhHiSysEventRemoveRustWatcher(watcher); in HiSysEventRemoveWatcherWrapper()
138 HiSysEventRustWatcherC* watcher = new(std::nothrow) HiSysEventRustWatcherC; in CreateRustEventWatcher() local
139 watcher->onEventRustCb = onEventRustCb; in CreateRustEventWatcher()
140 watcher->onEventWrapperCb = onEventWrapperCb; in CreateRustEventWatcher()
141 watcher->onServiceDiedRustCb = onServiceDiedRustCb; in CreateRustEventWatcher()
142 watcher->onServiceDiedWrapperCb = onServiceDiedWrapperCb; in CreateRustEventWatcher()
143 watcher->status = STATUS_NORMAL; in CreateRustEventWatcher()
[all …]
/base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent_manager/
Dhisysevent_manager_c.cpp61 int HiSysEventAddWatcher(HiSysEventWatcher& watcher, HiSysEventWatchRule rules[], size_t ruleSize) in HiSysEventAddWatcher() argument
69 std::make_shared<HiSysEventListenerC>(watcher.OnEvent, watcher.OnServiceDied)); in HiSysEventAddWatcher()
74 watchers[std::make_pair(watcher.OnEvent, watcher.OnServiceDied)] = listenerC; in HiSysEventAddWatcher()
78 int HiSysEventRemoveWatcher(HiSysEventWatcher& watcher) in HiSysEventRemoveWatcher() argument
80 auto watcherKey = std::make_pair(watcher.OnEvent, watcher.OnServiceDied); in HiSysEventRemoveWatcher()
109 int OH_HiSysEvent_Add_Watcher(HiSysEventWatcher* watcher, HiSysEventWatchRule rules[], size_t ruleS… in OH_HiSysEvent_Add_Watcher() argument
111 if (watcher == nullptr || watcher->OnEvent == nullptr || watcher->OnServiceDied == nullptr) { in OH_HiSysEvent_Add_Watcher()
114 return HiSysEventAddWatcher(*watcher, rules, ruleSize); in OH_HiSysEvent_Add_Watcher()
117 int OH_HiSysEvent_Remove_Watcher(HiSysEventWatcher* watcher) in OH_HiSysEvent_Remove_Watcher() argument
119 if (watcher == nullptr || watcher->OnEvent == nullptr || watcher->OnServiceDied == nullptr) { in OH_HiSysEvent_Remove_Watcher()
[all …]
/base/hiviewdfx/hisysevent/test/moduletest/common/
Dhisysevent_wrote_result_check_test.cpp83 void WriteAndWatch(std::shared_ptr<Watcher> watcher, T& val) in WriteAndWatch() argument
89 auto ret = OHOS::HiviewDFX::HiSysEventManager::AddListener(watcher, sysRules); in WriteAndWatch()
95 ret = OHOS::HiviewDFX::HiSysEventManager::RemoveListener(watcher); in WriteAndWatch()
134 auto watcher = std::make_shared<Watcher>([val] (std::shared_ptr<HiSysEventRecord> sysEvent) { in __anonbf3b641a0202() variable
142 WriteAndWatch(watcher, val);
155 auto watcher = std::make_shared<Watcher>([val] (std::shared_ptr<HiSysEventRecord> sysEvent) { in __anonbf3b641a0302() variable
163 WriteAndWatch(watcher, val);
176 auto watcher = std::make_shared<Watcher>([val] (std::shared_ptr<HiSysEventRecord> sysEvent) { in __anonbf3b641a0402() variable
184 WriteAndWatch(watcher, val);
197 auto watcher = std::make_shared<Watcher>([val] (std::shared_ptr<HiSysEventRecord> sysEvent) { in __anonbf3b641a0502() variable
[all …]
/base/startup/init/services/loopevent/task/
Dle_watchtask.c22 WatcherTask *watcher = (WatcherTask *)taskHandle; in HandleWatcherEvent_() local
26 if (watcher->processEvent != NULL) { in HandleWatcherEvent_()
27 watcher->processEvent(taskHandle, fd, &events, (void *)userData); in HandleWatcherEvent_()
29 watcher = (WatcherTask *)GetTaskByFd((EventLoop *)loopHandle, fd); in HandleWatcherEvent_()
30 LE_ONLY_CHECK(watcher != NULL, return 0); in HandleWatcherEvent_()
31 if (watcher->base.flags & WATCHER_ONCE) { in HandleWatcherEvent_()
32 loop->delEvent(loop, fd, watcher->events); in HandleWatcherEvent_()
36 loop->delEvent(loop, fd, watcher->events); in HandleWatcherEvent_()
39 if (events != watcher->events) { in HandleWatcherEvent_()
40 watcher->events = events; in HandleWatcherEvent_()
[all …]
/base/inputmethod/imf/test/unittest/cpp_test/src/
Dinput_method_dfx_test.cpp91 static bool WriteAndWatch(std::shared_ptr<Watcher> watcher, InputMethodDfxTest::ExecFunc exec);
104 bool InputMethodDfxTest::WriteAndWatch(std::shared_ptr<Watcher> watcher, InputMethodDfxTest::ExecFu… in WriteAndWatch() argument
109 auto ret = OHOS::HiviewDFX::HiSysEventManager::AddListener(watcher, sysRules); in WriteAndWatch()
114 std::unique_lock<std::mutex> lock(watcher->cvMutex_); in WriteAndWatch()
116 …bool result = watcher->watcherCv_.wait_for(lock, std::chrono::seconds(1)) != std::cv_status::timeo… in WriteAndWatch()
117 ret = OHOS::HiviewDFX::HiSysEventManager::RemoveListener(watcher); in WriteAndWatch()
221 auto watcher = std::make_shared<Watcher>( variable
224 EXPECT_TRUE(InputMethodDfxTest::WriteAndWatch(watcher, attach));
236 auto watcher = std::make_shared<Watcher>(InputMethodSysEvent::GetInstance().GetOperateInfo( variable
239 EXPECT_TRUE(InputMethodDfxTest::WriteAndWatch(watcher, hideTextInput));
[all …]
/base/hiviewdfx/hiappevent/frameworks/js/napi/src/
Dnapi_hiappevent_watch.cpp143 bool IsValidWatcher(const napi_env env, const napi_value watcher) in IsValidWatcher() argument
145 if (!NapiUtil::IsObject(env, watcher)) { in IsValidWatcher()
149 return IsValidName(env, NapiUtil::GetProperty(env, watcher, NAME_PROPERTY)) in IsValidWatcher()
150 && IsValidCondition(env, NapiUtil::GetProperty(env, watcher, COND_PROPERTY)) in IsValidWatcher()
151 && IsValidFilters(env, NapiUtil::GetProperty(env, watcher, FILTERS_PROPERTY)) in IsValidWatcher()
152 && IsValidTrigger(env, NapiUtil::GetProperty(env, watcher, TRIGGER_PROPERTY)); in IsValidWatcher()
163 std::string GetName(const napi_env env, const napi_value watcher) in GetName() argument
165 return NapiUtil::GetString(env, NapiUtil::GetProperty(env, watcher, NAME_PROPERTY)); in GetName()
168 TriggerCondition GetCondition(const napi_env env, const napi_value watcher) in GetCondition() argument
175 napi_value cond = NapiUtil::GetProperty(env, watcher, COND_PROPERTY); in GetCondition()
[all …]
/base/hiviewdfx/hisysevent/frameworks/native/c_wrapper/include/
Dhisysevent_rust_manager.h28 int OhHiSysEventAddRustWatcher(HiSysEventRustWatcherC* watcher, const HiSysEventWatchRule watchRule…
31 int OhHiSysEventRemoveRustWatcher(HiSysEventRustWatcherC* watcher);
33 void OhHiSysEventRecycleRustWatcher(HiSysEventRustWatcherC* watcher);
Dhisysevent_rust_listener.h27 HiSysEventRustListener(HiSysEventRustWatcherC* watcher);
35 void RecycleWatcher(HiSysEventRustWatcherC* watcher);
Dhisysevent_c_wrapper.h79 int HiSysEventAddWatcherWrapper(HiSysEventRustWatcherC* watcher, const HiSysEventWatchRule rules[],
83 int HiSysEventRemoveWatcherWrapper(HiSysEventRustWatcherC* watcher);
98 void RecycleRustEventWatcher(HiSysEventRustWatcherC* watcher);
/base/hiviewdfx/hisysevent/interfaces/rust/innerkits/src/
Dlib.rs117 pub fn add_watcher(watcher: &Watcher, watch_rules: &[WatchRule]) -> i32 { in add_watcher()
118 sys_event_manager::add_watcher(watcher, watch_rules) in add_watcher()
122 pub fn remove_watcher(watcher: &Watcher) -> i32 { in remove_watcher()
123 sys_event_manager::remove_watcher(watcher) in remove_watcher()
/base/hiviewdfx/hiappevent/frameworks/native/libhiappevent/watcher/
Dapp_event_watcher_mgr.cpp41 void AppEventWatcherMgr::AddWatcher(const std::shared_ptr<AppEventWatcher>& watcher) in AddWatcher() argument
44 std::string name = watcher->GetName(); in AddWatcher()
55 watchers_[name] = watcher; in AddWatcher()
58 if (watcher->GetCond().timeOut > 0 && handler_ == nullptr) { in AddWatcher()
80 [&] (const std::map<std::string, std::shared_ptr<AppEventWatcher>>::value_type& watcher) { in RemoveWatcher() argument
81 return watcher.second->GetCond().timeOut > 0; in RemoveWatcher()
/base/hiviewdfx/hisysevent/test/unittest/rust/src/
Dmain.rs62 let watcher = Watcher::new(|record: HiSysEventRecord| { in test_hisysevent_add_remove_watcher_001() localVariable
68 let mut ret = hisysevent::add_watcher(&watcher, &watch_rules); in test_hisysevent_add_remove_watcher_001()
85 ret = hisysevent::remove_watcher(&watcher); in test_hisysevent_add_remove_watcher_001()
88 watcher.try_to_recycle(); in test_hisysevent_add_remove_watcher_001()
89 ret = hisysevent::add_watcher(&watcher, &watch_rules); in test_hisysevent_add_remove_watcher_001()
/base/hiviewdfx/hiappevent/frameworks/js/napi/include/
Dnapi_hiappevent_watch.h26 napi_value AddWatcher(const napi_env env, const napi_value watcher);
27 napi_value RemoveWatcher(const napi_env env, const napi_value watcher);
/base/startup/init/services/param/watcher/agent/
Dwatcher_manager_kits.cpp149 ParamWatcherKitPtr watcher = nullptr; in AddWatcher() local
155 watcher = std::make_shared<ParamWatcher>(keyPrefix); in AddWatcher()
156 …WATCHER_CHECK(watcher != nullptr, return -1, "Failed to create watcher for %s", keyPrefix.c_str()); in AddWatcher()
157 int ret = watcher->AddParameterListener(callback, context); in AddWatcher()
161 watchers_[keyPrefix] = watcher; in AddWatcher()
163 watcher = watchers_[keyPrefix]; in AddWatcher()
164 int ret = watcher->AddParameterListener(callback, context); in AddWatcher()
180 WatcherManagerKits::ParamWatcher *watcher = GetParamWatcher(keyPrefix); in DelWatcher() local
181 WATCHER_CHECK(watcher != nullptr, return -1, "Failed to get watcher"); in DelWatcher()
183 int count = watcher->DelParameterListener(callback, context); in DelWatcher()
[all …]
Dwatcher_manager_proxy.cpp21 uint32_t WatcherManagerProxy::AddRemoteWatcher(uint32_t id, const sptr<IWatcher> &watcher) in AddRemoteWatcher() argument
23 WATCHER_CHECK(watcher != nullptr, return ERR_INVALID_VALUE, "Invalid param"); in AddRemoteWatcher()
26 bool ret = data.WriteRemoteObject(watcher->AsObject()); in AddRemoteWatcher()
/base/hiviewdfx/hisysevent/test/unittest/common/permission/
Dhisysevent_permission.test.js115 let watcher = {
126 hiSysEvent.addWatcher(watcher)
140 let watcher = {
151 hiSysEvent.removeWatcher(watcher)
/base/startup/init/services/param/watcher/proxy/
Dwatcher_manager.cpp39 uint32_t WatcherManager::AddRemoteWatcher(uint32_t id, const sptr<IWatcher> &watcher) in AddRemoteWatcher() argument
45 WATCHER_CHECK(watcher != nullptr, return 0, "Invalid remote watcher"); in AddRemoteWatcher()
47 sptr<IRemoteObject> object = watcher->AsObject(); in AddRemoteWatcher()
58 RemoteWatcher *remoteWatcher = new RemoteWatcher(remoteWatcherId, watcher); in AddRemoteWatcher()
69 sptr<IWatcher> watcher = {0}; in DelRemoteWatcher() local
75 watcher = remoteWatcher->GetWatcher(); in DelRemoteWatcher()
78 sptr<IRemoteObject> object = watcher->AsObject(); in DelRemoteWatcher()
738 WatcherNodePtr watcher = WatcherNode::ConvertNodeToBase(node); in CompareNode() local
740 return watcher->nodeId_ - newWatcher->nodeId_; in CompareNode()
745 WatcherNodePtr watcher = WatcherNode::ConvertNodeToBase(node); in CompareData() local
[all …]
Dwatcher_manager_stub.cpp47 sptr<IWatcher> watcher = new WatcherProxy(remote); in OnRemoteRequest() local
48 uint32_t remoteWatcherId = AddRemoteWatcher(id, watcher); in OnRemoteRequest()
/base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent_manager/include/
Dhisysevent_manager_c.h94 int OH_HiSysEvent_Add_Watcher(HiSysEventWatcher* watcher, HiSysEventWatchRule rules[], size_t ruleS…
101 int OH_HiSysEvent_Remove_Watcher(HiSysEventWatcher* watcher);
/base/startup/init/services/
DBUILD.gn44 "//base/startup/init/services/param/watcher:param_watcher",
45 "//base/startup/init/services/param/watcher:param_watcher.rc",
46 "//base/startup/init/services/param/watcher/sa_profile:param_watcher_profile",
/base/startup/init/services/param/linux/
Dparam_service.c39 ParamWatcher *watcher = (ParamWatcher *)ParamGetTaskUserData(client); in OnClose() local
41 ClearWatchTrigger(watcher, TRIGGER_PARAM_WATCH); in OnClose()
44 ClearWatchTrigger(watcher, TRIGGER_PARAM_WAIT); in OnClose()
180 ParamWatcher *watcher = NULL; in AddWatchNode() local
182 watcher = (ParamWatcher *)ParamGetTaskUserData(extInfo->stream); in AddWatchNode()
184 PARAM_CHECK(watcher != NULL, return -1, "Failed to get param watcher data"); in AddWatchNode()
191 OH_ListAddTail(&watcher->triggerHead, &node->item); in AddWatchNode()
196 OH_ListAddTail(&watcher->triggerHead, &node->item); in AddWatchNode()
348 ParamWatcher *watcher = (ParamWatcher *)ParamGetTaskUserData(client); in OnIncomingConnect() local
349 PARAM_CHECK(watcher != NULL, return -1, "Failed to get watcher"); in OnIncomingConnect()
[all …]
/base/hiviewdfx/hiappevent/test/unittest/common/napi/
Dnapi_hiappevent.test.js1007 function addWatcherTypeTest(watcher) { argument
1009 hiAppEventV9.addWatcher(watcher);
1014 function removeWatcherTypeTest(watcher) { argument
1016 hiAppEventV9.removeWatcher(watcher);
1329 let watcher = { variable
1350 let result = hiAppEventV9.addWatcher(watcher);
1356 hiAppEventV9.removeWatcher(watcher);
1370 let watcher = { variable
1393 let result = hiAppEventV9.addWatcher(watcher);
1400 hiAppEventV9.removeWatcher(watcher);
[all …]

123