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

Unified Diff: chrome/browser/chromeos/extensions/file_browser_event_router.h

Issue 13474015: drive: Fix lifetime model of FileBrowserEventRouter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
Index: chrome/browser/chromeos/extensions/file_browser_event_router.h
diff --git a/chrome/browser/chromeos/extensions/file_browser_event_router.h b/chrome/browser/chromeos/extensions/file_browser_event_router.h
index 9247bd8805498b2347991e52fb04b56cac1abe16..8168fc107b2425c3a7558a1d159868421c714270 100644
--- a/chrome/browser/chromeos/extensions/file_browser_event_router.h
+++ b/chrome/browser/chromeos/extensions/file_browser_event_router.h
@@ -34,13 +34,14 @@ class DriveFileSystemInterface;
// Monitors changes in disk mounts, network connection state and preferences
// affecting File Manager. Dispatches appropriate File Browser events.
class FileBrowserEventRouter
- : public base::RefCountedThreadSafe<FileBrowserEventRouter>,
- public chromeos::disks::DiskMountManager::Observer,
+ : public chromeos::disks::DiskMountManager::Observer,
public chromeos::ConnectivityStateHelperObserver,
public chromeos::SystemKeyEventListener::ModifiersObserver,
public drive::DriveFileSystemObserver,
public google_apis::DriveServiceObserver {
public:
+ virtual ~FileBrowserEventRouter();
hashimoto 2013/04/08 04:49:38 nit: How about moving this dtor to after SuspendSt
satorux1 2013/04/08 05:03:37 Done.
+
// Interface that should keep track of the system state in regards to system
// suspend and resume events.
// When the |IsResuming()| returns true, it should be able to check if a
@@ -110,7 +111,6 @@ class FileBrowserEventRouter
private:
friend class FileBrowserPrivateAPI;
- friend class base::RefCountedThreadSafe<FileBrowserEventRouter>;
typedef std::map<std::string, int> ExtensionUsageRegistry;
@@ -147,7 +147,6 @@ class FileBrowserEventRouter
typedef std::map<base::FilePath, FileWatcherExtensions*> WatcherMap;
explicit FileBrowserEventRouter(Profile* profile);
hashimoto 2013/04/08 04:49:38 Can't we make this ctor public and remove "friend
satorux1 2013/04/08 05:03:37 Done. Good catch!
- virtual ~FileBrowserEventRouter();
// USB mount event handlers.
void OnDiskAdded(const chromeos::disks::DiskMountManager::Disk* disk);
@@ -196,7 +195,6 @@ class FileBrowserEventRouter
// zero.
void HandleRemoteUpdateRequestOnUIThread(bool start);
- base::WeakPtrFactory<FileBrowserEventRouter> weak_factory_;
base::FilePathWatcher::Callback file_watcher_callback_;
WatcherMap file_watchers_;
scoped_ptr<FileBrowserNotifications> notifications_;
@@ -212,6 +210,9 @@ class FileBrowserEventRouter
// for power users.
bool shift_pressed_;
+ // Note: This should remain the last member so it'll be destroyed and
+ // invalidate the weak pointers before any other members are destroyed.
+ base::WeakPtrFactory<FileBrowserEventRouter> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(FileBrowserEventRouter);
};

Powered by Google App Engine
This is Rietveld 408576698