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

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

Issue 10537092: Media Gallery: Register isolated file systems on a per RenderProcessHost basis. Otherwise when one… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 6 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.h
===================================================================
--- chrome/browser/media_gallery/media_file_system_registry.h (revision 141331)
+++ chrome/browser/media_gallery/media_file_system_registry.h (working copy)
@@ -17,16 +17,22 @@
#include "base/basictypes.h"
#include "base/lazy_instance.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
class FilePath;
+namespace content {
+class RenderProcessHost;
+}
+
namespace fileapi {
class IsolatedContext;
}
namespace chrome {
-class MediaFileSystemRegistry {
+class MediaFileSystemRegistry : public content::NotificationObserver {
public:
// (Filesystem ID, path)
typedef std::pair<std::string, FilePath> MediaFSIDAndPath;
@@ -34,26 +40,44 @@
// The instance is lazily created per browser process.
static MediaFileSystemRegistry* GetInstance();
- // Returns the list of media filesystem IDs and paths.
+ // Returns the list of media filesystem IDs and paths for a given RPH.
// Called on the UI thread.
- std::vector<MediaFSIDAndPath> GetMediaFileSystems() const;
+ std::vector<MediaFSIDAndPath> GetMediaFileSystems(
+ const content::RenderProcessHost* rph);
+ // content::NotificationObserver implementation.
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
private:
friend struct base::DefaultLazyInstanceTraits<MediaFileSystemRegistry>;
// Mapping of media directories to filesystem IDs.
typedef std::map<FilePath, std::string> MediaPathToFSIDMap;
+ // Mapping of RPH to MediaPathToFSIDMaps.
+ typedef std::map<const content::RenderProcessHost*,
+ MediaPathToFSIDMap> ChildIdToMediaFSMap;
+
// Obtain an instance of this class via GetInstance().
MediaFileSystemRegistry();
virtual ~MediaFileSystemRegistry();
- // Registers a path as a media file system.
- void RegisterPathAsFileSystem(const FilePath& path);
+ // Helper functions to register / unregister listening for renderer process
+ // closed / terminiated notifications.
+ void RegisterForRPHGoneNotifications(const content::RenderProcessHost* rph);
+ void UnregisterForRPHGoneNotifications(const content::RenderProcessHost* rph);
+ // Registers a path as a media file system and return the filesystem id.
+ std::string RegisterPathAsFileSystem(const FilePath& path);
+
// Only accessed on the UI thread.
- MediaPathToFSIDMap media_fs_map_;
+ ChildIdToMediaFSMap media_fs_map_;
+ // Is only used on the UI Thread.
+ content::NotificationRegistrar registrar_;
+
DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry);
};

Powered by Google App Engine
This is Rietveld 408576698