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

Unified Diff: chrome/browser/storage_monitor/storage_monitor.h

Issue 16703025: [StorageMonitor] Move StorageMonitor ownership to BrowserProcessImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Catch up to SystemInfoStorage eject test Created 7 years, 5 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/storage_monitor/storage_monitor.h
diff --git a/chrome/browser/storage_monitor/storage_monitor.h b/chrome/browser/storage_monitor/storage_monitor.h
index 36e81e93587b022c3cc9477d5da2d4192684832d..9d20d60d47c8e76e32662f049d6050b619fbd35f 100644
--- a/chrome/browser/storage_monitor/storage_monitor.h
+++ b/chrome/browser/storage_monitor/storage_monitor.h
@@ -36,8 +36,8 @@ class TransientDeviceIds;
// Base class for platform-specific instances watching for removable storage
// attachments/detachments.
-// Lifecycle contracts: This class is created by ChromeBrowserMain
-// implementations before the profile is initialized, so listeners can be
+// Lifecycle contracts: This class is created in the browser process
+// before the profile is initialized, so listeners can be
// created during profile construction. The platform-specific initialization,
// which can lead to calling registered listeners with notifications of
// attached volumes, are done lazily at first use through the async
@@ -69,10 +69,18 @@ class StorageMonitor {
EJECT_FAILURE
};
- // Returns a pointer to an object owned by the BrowserMainParts, with lifetime
- // somewhat shorter than a process Singleton.
+ // Returns a pointer to a newly created per-platform object with the
+ // StorageMonitor interface.
+ static StorageMonitor* Create();
+
+ // Returns a pointer to an object owned by BrowserProcess, with lifetime
+ // starting before main message loop start, and ending after main message loop
+ // shutdown. Called outside it's lifetime (or with no browser process),
+ // returns NULL.
static StorageMonitor* GetInstance();
+ virtual ~StorageMonitor();
+
// Ensures that the storage monitor is initialized. The provided callback, If
// non-null, will be called when initialization is complete. If initialization
// has already completed, this callback will be invoked within the calling
@@ -134,11 +142,6 @@ class StorageMonitor {
friend class ::SystemInfoStorageEjectApiTest;
StorageMonitor();
- virtual ~StorageMonitor();
-
- // Removes the existing singleton for testing.
- // (So that a new one can be created.)
- static void RemoveSingletonForTesting();
virtual Receiver* receiver() const;

Powered by Google App Engine
This is Rietveld 408576698