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

Unified Diff: chrome/browser/media_galleries/media_file_system_registry.h

Issue 24269007: Media Galleries API: Fix MediaGalleriesPreferences finders race. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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_galleries/media_file_system_registry.h
diff --git a/chrome/browser/media_galleries/media_file_system_registry.h b/chrome/browser/media_galleries/media_file_system_registry.h
index 4c6b77716ed5b285632328819641dc7b7074563c..aacc435b7e504f9ea140fab5d7e09150d3bb123b 100644
--- a/chrome/browser/media_galleries/media_file_system_registry.h
+++ b/chrome/browser/media_galleries/media_file_system_registry.h
@@ -76,13 +76,9 @@ class MediaFileSystemRegistry
const extensions::Extension* extension,
const MediaFileSystemsCallback& callback);
- // Returns the initialized media galleries preferences for the specified
- // |profile|. This method should be used instead of calling
- // MediaGalleriesPreferences directly because this method also ensures that
- // currently attached removable devices are added to the preferences.
- // Called on the UI thread.
- // Note: Caller must ensure that the storage monitor is initialized before
- // calling this method.
+ // Returns the media galleries preferences for the specified |profile|.
+ // Called on the UI thread. Caller is responsible for ensuring that the
+ // preferences are initialized before use.
MediaGalleriesPreferences* GetPreferences(Profile* profile);
// RemovableStorageObserver implementation.
@@ -105,6 +101,11 @@ class MediaFileSystemRegistry
typedef std::map<const base::FilePath::StringType, ScopedMTPDeviceMapEntry*>
MTPDeviceDelegateMap;
+ void FinishGetMediaFileSystemsForExtension(
+ const content::RenderViewHost* rvh,
+ const extensions::Extension* extension,
+ const MediaFileSystemsCallback& callback);
+
virtual void OnPermissionRemoved(MediaGalleriesPreferences* pref,
const std::string& extension_id,
MediaGalleryPrefId pref_id) OVERRIDE;
@@ -123,6 +124,8 @@ class MediaFileSystemRegistry
void OnExtensionGalleriesHostEmpty(Profile* profile,
const std::string& extension_id);
+ base::WeakPtrFactory<MediaFileSystemRegistry> weak_factory_;
+
// Only accessed on the UI thread. This map owns all the
// ExtensionGalleriesHost objects created.
ExtensionGalleriesHostMap extension_hosts_map_;

Powered by Google App Engine
This is Rietveld 408576698