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

Unified Diff: ui/events/devices/x11/device_data_manager_x11.cc

Issue 1202383002: Changed DeviceDataManager to be able to create multiple instances for the purposes of test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed DeviceDataManagerX11 singleton instance to be deleted at exit. Created 5 years, 6 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 | « ui/events/devices/device_data_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/devices/x11/device_data_manager_x11.cc
diff --git a/ui/events/devices/x11/device_data_manager_x11.cc b/ui/events/devices/x11/device_data_manager_x11.cc
index 230b7fa5328cbecf9e0ee76c31428712ea5489a2..0f62b33f5fbc2bb9988a78872a17bcbfb81d89a4 100644
--- a/ui/events/devices/x11/device_data_manager_x11.cc
+++ b/ui/events/devices/x11/device_data_manager_x11.cc
@@ -10,6 +10,8 @@
#include <utility>
+#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/logging.h"
#include "base/memory/singleton.h"
#include "base/sys_info.h"
@@ -130,7 +132,11 @@ void DeviceDataManagerX11::CreateInstance() {
if (instance())
return;
- new DeviceDataManagerX11();
+ DeviceDataManagerX11* device_data_manager = new DeviceDataManagerX11();
+ base::AtExitManager::RegisterTask(
+ base::Bind(&base::DeletePointer<DeviceDataManager>, device_data_manager));
sadrul 2015/06/27 07:09:05 Can we avoid setting a callback here, and explicit
+
+ set_instance(device_data_manager);
}
// static
« no previous file with comments | « ui/events/devices/device_data_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698