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

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

Issue 14556015: [Media Galleries] Lazily initialize the storage monitor. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Harden async boundary in WebUI Created 7 years, 7 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 7eab0b7743b925d9b3fffa009623e946c32b496d..d69d57d78025312112f6d742aac5df7f5b30297f 100644
--- a/chrome/browser/storage_monitor/storage_monitor.h
+++ b/chrome/browser/storage_monitor/storage_monitor.h
@@ -39,7 +39,15 @@ class TransientDeviceIds;
// implementations 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, will happen after profile construction.
+// attached volumes, are done lazily at first use through the async
+// |Initialize()| method. That must be done before any of the registered
+// listeners will receive updates or calls to other API methods return
+// meaningful results.
+// A post-initialization |GetAttachedStorage()| call coupled with a
+// registered listener will receive a complete set, albeit potentially with
+// duplicates. This is because there's no tracking between when listeners were
+// registered and the state of initialization, and the fact that platforms
+// behave differently in how these notifications are provided.
class StorageMonitor {
public:
// This interface is provided to generators of storage notifications.
@@ -153,6 +161,7 @@ class StorageMonitor {
scoped_refptr<ObserverListThreadSafe<RemovableStorageObserver> >
observer_list_;
+ bool initializing_;
bool initialized_;
std::vector<base::Closure> on_initialize_callbacks_;

Powered by Google App Engine
This is Rietveld 408576698