Chromium Code Reviews| 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)); |