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

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

Issue 14556015: [Media Galleries] Lazily initialize the storage monitor. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix merge 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.cc
diff --git a/chrome/browser/storage_monitor/storage_monitor.cc b/chrome/browser/storage_monitor/storage_monitor.cc
index 682264223c40b147f4446a65e51ef9b9b042da53..db2d91a881d0e74d609785a646501d8ccbab3a85 100644
--- a/chrome/browser/storage_monitor/storage_monitor.cc
+++ b/chrome/browser/storage_monitor/storage_monitor.cc
@@ -62,6 +62,7 @@ std::vector<StorageInfo> StorageMonitor::GetAttachedStorage() const {
}
void StorageMonitor::Initialize(base::Closure callback) {
+ DCHECK(thread_checker_.CalledOnValidThread());
Lei Zhang 2013/06/03 20:17:13 Isn't this always the UI thread?
Greg Billock 2013/06/03 22:33:02 Not in tests.
if (initialized_) {
if (!callback.is_null())
callback.Run();
@@ -72,6 +73,10 @@ void StorageMonitor::Initialize(base::Closure callback) {
on_initialize_callbacks_.push_back(callback);
}
+ if (initializing_)
+ return;
+
+ initializing_ = true;
Init();
}
@@ -108,6 +113,7 @@ void StorageMonitor::EjectDevice(
StorageMonitor::StorageMonitor()
: observer_list_(new ObserverListThreadSafe<RemovableStorageObserver>()),
+ initializing_(false),
initialized_(false),
transient_device_ids_(new TransientDeviceIds) {
receiver_.reset(new ReceiverImpl(this));
« no previous file with comments | « chrome/browser/storage_monitor/storage_monitor.h ('k') | chrome/browser/storage_monitor/test_storage_monitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698