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

Unified Diff: chrome/browser/media_gallery/media_file_system_registry.cc

Issue 12212083: Media Galleries: Only try to initialize removable media galleries once per profile. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rebase Created 7 years, 10 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/media_gallery/media_file_system_registry.cc
===================================================================
--- chrome/browser/media_gallery/media_file_system_registry.cc (revision 181939)
+++ chrome/browser/media_gallery/media_file_system_registry.cc (working copy)
@@ -545,6 +545,10 @@
if (ContainsKey(extension_hosts_map_, profile))
return preferences;
+ // Create an empty entry so the initialization code below only gets called
vandebo (ex-Chrome) 2013/02/12 22:44:30 I still don't see the value of this. When we rest
Lei Zhang 2013/02/12 23:01:53 While Chrome is running, every time GetPreferences
+ // once per profile.
+ extension_hosts_map_[profile] = ExtensionHostMap();
+
// RemovableStorageNotifications may be NULL in unit tests.
RemovableStorageNotifications* notifications =
RemovableStorageNotifications::GetInstance();
@@ -625,8 +629,15 @@
}
}
-size_t MediaFileSystemRegistry::GetExtensionHostCountForTests() const {
- return extension_hosts_map_.size();
+size_t MediaFileSystemRegistry::GetExtensionGalleriesHostCountForTests() const {
+ size_t extension_galleries_host_count = 0;
+ for (ExtensionGalleriesHostMap::const_iterator it =
+ extension_hosts_map_.begin();
+ it != extension_hosts_map_.end();
+ ++it) {
+ extension_galleries_host_count += it->second.size();
+ }
+ return extension_galleries_host_count;
}
uint64 MediaFileSystemRegistry::GetTransientIdForDeviceId(
@@ -804,8 +815,6 @@
extension_hosts->second.erase(extension_id);
DCHECK_EQ(1U, erase_count);
if (extension_hosts->second.empty()) {
- extension_hosts_map_.erase(extension_hosts);
vandebo (ex-Chrome) 2013/02/12 23:11:37 nit: add a comment about not erasing extension_hos
Lei Zhang 2013/02/12 23:30:59 Done.
-
PrefChangeRegistrarMap::iterator pref_it =
pref_change_registrar_map_.find(profile);
DCHECK(pref_it != pref_change_registrar_map_.end());

Powered by Google App Engine
This is Rietveld 408576698