Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(719)

Unified Diff: content/browser/plugin_service_impl.cc

Issue 632833002: Remove raw handles from base::win::RegKey (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove XP specific code. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/plugin_service_impl.h ('k') | net/dns/dns_config_service_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/plugin_service_impl.cc
diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc
index 1b7ad7641c43cbb8d517b76869f17def73732935..d19f6861c162b2a289d2ca1ccf85a13f3d21bf66 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_);
« no previous file with comments | « content/browser/plugin_service_impl.h ('k') | net/dns/dns_config_service_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698