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

Unified Diff: chrome/browser/system_monitor/removable_device_notifications_mac.h

Issue 10948019: Remove use of weakptr for RemovableDeviceNotificationsMac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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
Index: chrome/browser/system_monitor/removable_device_notifications_mac.h
diff --git a/chrome/browser/system_monitor/removable_device_notifications_mac.h b/chrome/browser/system_monitor/removable_device_notifications_mac.h
index aa6f31ab2ef789c7723d61a0d75ca48015e035ce..d58d762d59bc6339f3bdae5548af09d0cc3fee1f 100644
--- a/chrome/browser/system_monitor/removable_device_notifications_mac.h
+++ b/chrome/browser/system_monitor/removable_device_notifications_mac.h
@@ -9,7 +9,7 @@
#include <map>
#include "base/mac/scoped_cftyperef.h"
-#include "base/memory/weak_ptr.h"
+#include "base/memory/ref_counted.h"
#include "base/system_monitor/system_monitor.h"
#include "chrome/browser/system_monitor/disk_info_mac.h"
@@ -21,7 +21,7 @@ typedef RemovableDeviceNotificationsMac RemovableDeviceNotifications;
// This class posts notifications to base::SystemMonitor when a new disk
// is attached, removed, or changed.
class RemovableDeviceNotificationsMac :
- public base::SupportsWeakPtr<RemovableDeviceNotificationsMac> {
+ public base::RefCountedThreadSafe<RemovableDeviceNotificationsMac> {
public:
enum UpdateType {
UPDATE_DEVICE_ADDED,
@@ -31,7 +31,6 @@ class RemovableDeviceNotificationsMac :
// Should only be called by browser start up code. Use GetInstance() instead.
RemovableDeviceNotificationsMac();
- virtual ~RemovableDeviceNotificationsMac();
static RemovableDeviceNotificationsMac* GetInstance();
@@ -42,6 +41,9 @@ class RemovableDeviceNotificationsMac :
base::SystemMonitor::RemovableStorageInfo* device_info) const;
private:
+ friend class base::RefCountedThreadSafe<RemovableDeviceNotificationsMac>;
+ virtual ~RemovableDeviceNotificationsMac();
+
static void DiskAppearedCallback(DADiskRef disk, void* context);
static void DiskDisappearedCallback(DADiskRef disk, void* context);
static void DiskDescriptionChangedCallback(DADiskRef disk,

Powered by Google App Engine
This is Rietveld 408576698