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

Unified Diff: device/hid/hid_service.cc

Issue 1074963003: Clean up potentially leaky use of base::DeletePointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed another probleb Created 5 years, 8 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 | « device/hid/hid_service.h ('k') | device/usb/usb_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/hid/hid_service.cc
diff --git a/device/hid/hid_service.cc b/device/hid/hid_service.cc
index fc50a41d5abf0841ffece481f03054d2d1fe43f2..433a80b5d6a6c413ef5babc4eea5f3d7e93dd2e1 100644
--- a/device/hid/hid_service.cc
+++ b/device/hid/hid_service.cc
@@ -45,8 +45,9 @@ HidService* HidService::GetInstance(
g_service = new HidServiceWin(file_task_runner);
#endif
if (g_service != nullptr) {
+ scoped_ptr<HidService> owned_service(g_service);
base::AtExitManager::RegisterTask(base::Bind(
- &base::DeletePointer<HidService>, base::Unretained(g_service)));
+ &base::DeletePointer<HidService>, base::Passed(&owned_service)));
}
}
return g_service;
@@ -55,8 +56,9 @@ HidService* HidService::GetInstance(
void HidService::SetInstanceForTest(HidService* instance) {
DCHECK(!g_service);
g_service = instance;
+ scoped_ptr<HidService> owned_service(instance);
base::AtExitManager::RegisterTask(base::Bind(&base::DeletePointer<HidService>,
- base::Unretained(g_service)));
+ base::Passed(&owned_service)));
}
void HidService::GetDevices(const GetDevicesCallback& callback) {
« no previous file with comments | « device/hid/hid_service.h ('k') | device/usb/usb_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698