diff options
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/browser/info_map.cc | 17 | ||||
-rw-r--r-- | extensions/browser/info_map.h | 16 |
2 files changed, 32 insertions, 1 deletions
diff --git a/extensions/browser/info_map.cc b/extensions/browser/info_map.cc index 3f55ceb..7122eb0 100644 --- a/extensions/browser/info_map.cc +++ b/extensions/browser/info_map.cc @@ -44,6 +44,10 @@ InfoMap::InfoMap() : signin_process_id_(-1) {} const ProcessMap& InfoMap::process_map() const { return process_map_; } +const ProcessMap& InfoMap::worker_process_map() const { + return worker_process_map_; +} + void InfoMap::AddExtension(const Extension* extension, base::Time install_time, bool incognito_enabled, @@ -124,6 +128,19 @@ void InfoMap::UnregisterAllExtensionsInProcess(int process_id) { process_map_.RemoveAllFromProcess(process_id); } +void InfoMap::RegisterExtensionWorkerProcess(const std::string& extension_id, + int process_id, + int site_instance_id) { + if (!worker_process_map_.Insert(extension_id, process_id, site_instance_id)) { + NOTREACHED() << "Duplicate extension worker process registration for: " + << extension_id << "," << process_id << "."; + } +} + +void InfoMap::UnregisterExtensionWorkerProcess(int process_id) { + worker_process_map_.RemoveAllFromProcess(process_id); +} + void InfoMap::GetExtensionsWithAPIPermissionForSecurityOrigin( const GURL& origin, int process_id, diff --git a/extensions/browser/info_map.h b/extensions/browser/info_map.h index 34e1a9a..6609604 100644 --- a/extensions/browser/info_map.h +++ b/extensions/browser/info_map.h @@ -30,7 +30,10 @@ class InfoMap : public base::RefCountedThreadSafe<InfoMap> { return disabled_extensions_; } + // Information about which extensions are assigned to which render processes. const extensions::ProcessMap& process_map() const; + // Information about which extensions are assigned to which worker processes. + const extensions::ProcessMap& worker_process_map() const; // Callback for when new extensions are loaded. void AddExtension(const extensions::Extension* extension, @@ -64,6 +67,14 @@ class InfoMap : public base::RefCountedThreadSafe<InfoMap> { int site_instance_id); void UnregisterAllExtensionsInProcess(int process_id); + // Adds an entry to worker_process_map_. + void RegisterExtensionWorkerProcess(const std::string& extension_id, + int process_id, + int site_instance_id); + + // Removes an entry from worker_process_map_. + void UnregisterExtensionWorkerProcess(int process_id); + // Returns the subset of extensions which has the same |origin| in // |process_id| with the specified |permission|. void GetExtensionsWithAPIPermissionForSecurityOrigin( @@ -113,9 +124,12 @@ class InfoMap : public base::RefCountedThreadSafe<InfoMap> { // the IO thread. scoped_ptr<QuotaService> quota_service_; - // Assignment of extensions to processes. + // Assignment of extensions to renderer processes. extensions::ProcessMap process_map_; + // Assignment of extensions to worker processes. + extensions::ProcessMap worker_process_map_; + int signin_process_id_; }; |