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

Side by Side Diff: ui/events/devices/device_data_manager.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 unified diff | Download patch
« no previous file with comments | « media/cast/sender/video_encoder_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/events/devices/device_data_manager.h" 5 #include "ui/events/devices/device_data_manager.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/events/devices/input_device_event_observer.h" 10 #include "ui/events/devices/input_device_event_observer.h"
(...skipping 10 matching lines...) Expand all
21 21
22 } // namespace 22 } // namespace
23 23
24 // static 24 // static
25 DeviceDataManager* DeviceDataManager::instance_ = NULL; 25 DeviceDataManager* DeviceDataManager::instance_ = NULL;
26 26
27 DeviceDataManager::DeviceDataManager() { 27 DeviceDataManager::DeviceDataManager() {
28 CHECK(!instance_) << "Can not create multiple instances of DeviceDataManager"; 28 CHECK(!instance_) << "Can not create multiple instances of DeviceDataManager";
29 instance_ = this; 29 instance_ = this;
30 30
31 scoped_ptr<DeviceDataManager> owned_instance(instance_);
31 base::AtExitManager::RegisterTask( 32 base::AtExitManager::RegisterTask(
32 base::Bind(&base::DeletePointer<DeviceDataManager>, this)); 33 base::Bind(&base::DeletePointer<DeviceDataManager>,
34 base::Passed(&owned_instance)));
33 35
34 ClearTouchDeviceAssociations(); 36 ClearTouchDeviceAssociations();
35 } 37 }
36 38
37 DeviceDataManager::~DeviceDataManager() { 39 DeviceDataManager::~DeviceDataManager() {
38 CHECK_EQ(this, instance_); 40 CHECK_EQ(this, instance_);
39 instance_ = NULL; 41 instance_ = NULL;
40 } 42 }
41 43
42 // static 44 // static
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 180
179 void DeviceDataManager::AddObserver(InputDeviceEventObserver* observer) { 181 void DeviceDataManager::AddObserver(InputDeviceEventObserver* observer) {
180 observers_.AddObserver(observer); 182 observers_.AddObserver(observer);
181 } 183 }
182 184
183 void DeviceDataManager::RemoveObserver(InputDeviceEventObserver* observer) { 185 void DeviceDataManager::RemoveObserver(InputDeviceEventObserver* observer) {
184 observers_.RemoveObserver(observer); 186 observers_.RemoveObserver(observer);
185 } 187 }
186 188
187 } // namespace ui 189 } // namespace ui
OLDNEW
« no previous file with comments | « media/cast/sender/video_encoder_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698