summaryrefslogtreecommitdiffstats
path: root/content/browser/plugin_service_impl.cc
diff options
context:
space:
mode:
authorrvargas <rvargas@chromium.org>2014-10-16 18:28:58 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-17 01:29:21 +0000
commit6f315b85b9126cdbbeee5457a7fa1dbeed058105 (patch)
tree94595e0e952654a1c1d9132b256ab004c72dbbad /content/browser/plugin_service_impl.cc
parentfde4714574d7c7c7f87620e7735c4bcf474df2ec (diff)
downloadchromium_src-6f315b85b9126cdbbeee5457a7fa1dbeed058105.zip
chromium_src-6f315b85b9126cdbbeee5457a7fa1dbeed058105.tar.gz
chromium_src-6f315b85b9126cdbbeee5457a7fa1dbeed058105.tar.bz2
Remove raw handles from base::win::RegKey
BUG=419210, 423634 R=cpu@chromium.org, eroman@chromium.org, sky@chromium.org Committed: https://crrev.com/1aa0fa75b65f403e08ae0f3f2fcb053c02cd9ef2 Cr-Commit-Position: refs/heads/master@{#299737} Review URL: https://codereview.chromium.org/632833002 Cr-Commit-Position: refs/heads/master@{#300036}
Diffstat (limited to 'content/browser/plugin_service_impl.cc')
-rw-r--r--content/browser/plugin_service_impl.cc47
1 files changed, 13 insertions, 34 deletions
diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc
index 1b7ad76..d19f686 100644
--- a/content/browser/plugin_service_impl.cc
+++ b/content/browser/plugin_service_impl.cc
@@ -157,15 +157,6 @@ PluginServiceImpl::PluginServiceImpl()
}
PluginServiceImpl::~PluginServiceImpl() {
-#if defined(OS_WIN)
- // Release the events since they're owned by RegKey, not WaitableEvent.
- hkcu_watcher_.StopWatching();
- hklm_watcher_.StopWatching();
- if (hkcu_event_)
- hkcu_event_->Release();
- if (hklm_event_)
- hklm_event_->Release();
-#endif
// Make sure no plugin channel requests have been leaked.
DCHECK(pending_plugin_clients_.empty());
}
@@ -200,24 +191,18 @@ void PluginServiceImpl::StartWatchingPlugins() {
if (hkcu_key_.Create(HKEY_CURRENT_USER,
kRegistryMozillaPlugins,
KEY_NOTIFY) == ERROR_SUCCESS) {
- if (hkcu_key_.StartWatching() == ERROR_SUCCESS) {
- hkcu_event_.reset(new base::WaitableEvent(hkcu_key_.watch_event()));
- base::WaitableEventWatcher::EventCallback callback =
- base::Bind(&PluginServiceImpl::OnWaitableEventSignaled,
- base::Unretained(this));
- hkcu_watcher_.StartWatching(hkcu_event_.get(), callback);
- }
+ base::win::RegKey::ChangeCallback callback =
+ base::Bind(&PluginServiceImpl::OnKeyChanged, base::Unretained(this),
+ base::Unretained(&hkcu_key_));
+ hkcu_key_.StartWatching(callback);
}
if (hklm_key_.Create(HKEY_LOCAL_MACHINE,
kRegistryMozillaPlugins,
KEY_NOTIFY) == ERROR_SUCCESS) {
- if (hklm_key_.StartWatching() == ERROR_SUCCESS) {
- hklm_event_.reset(new base::WaitableEvent(hklm_key_.watch_event()));
- base::WaitableEventWatcher::EventCallback callback =
- base::Bind(&PluginServiceImpl::OnWaitableEventSignaled,
- base::Unretained(this));
- hklm_watcher_.StartWatching(hklm_event_.get(), callback);
- }
+ base::win::RegKey::ChangeCallback callback =
+ base::Bind(&PluginServiceImpl::OnKeyChanged, base::Unretained(this),
+ base::Unretained(&hkcu_key_));
+ hklm_key_.StartWatching(callback);
}
#endif
#if defined(OS_POSIX) && !defined(OS_OPENBSD) && !defined(OS_ANDROID)
@@ -642,22 +627,16 @@ void PluginServiceImpl::GetPluginsOnIOThread(
}
#endif
-void PluginServiceImpl::OnWaitableEventSignaled(
- base::WaitableEvent* waitable_event) {
#if defined(OS_WIN)
- if (waitable_event == hkcu_event_) {
- hkcu_key_.StartWatching();
- } else {
- hklm_key_.StartWatching();
- }
+void PluginServiceImpl::OnKeyChanged(base::win::RegKey* key) {
+ key->StartWatching(base::Bind(&PluginServiceImpl::OnKeyChanged,
+ base::Unretained(this),
+ base::Unretained(&hkcu_key_)));
PluginList::Singleton()->RefreshPlugins();
PurgePluginListCache(NULL, false);
-#else
- // This event should only get signaled on a Windows machine.
- NOTREACHED();
-#endif // defined(OS_WIN)
}
+#endif // defined(OS_WIN)
void PluginServiceImpl::RegisterPepperPlugins() {
ComputePepperPluginList(&ppapi_plugins_);