OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 140 |
141 // The BrowsingInstance shared by all extensions in this profile. This | 141 // The BrowsingInstance shared by all extensions in this profile. This |
142 // controls process grouping. | 142 // controls process grouping. |
143 scoped_refptr<BrowsingInstance> browsing_instance_; | 143 scoped_refptr<BrowsingInstance> browsing_instance_; |
144 | 144 |
145 // A map of site instance ID to the ID of the extension it hosts. | 145 // A map of site instance ID to the ID of the extension it hosts. |
146 typedef std::map<int, std::string> SiteInstanceIDMap; | 146 typedef std::map<int, std::string> SiteInstanceIDMap; |
147 SiteInstanceIDMap extension_ids_; | 147 SiteInstanceIDMap extension_ids_; |
148 | 148 |
149 // A map of process ID to site instance ID of the site instances it hosts. | 149 // A map of process ID to site instance ID of the site instances it hosts. |
150 typedef std::map<int, std::set<int> > ProcessIDMap; | 150 typedef std::set<int> SiteInstanceIDSet; |
| 151 typedef std::map<int, SiteInstanceIDSet> ProcessIDMap; |
151 ProcessIDMap process_ids_; | 152 ProcessIDMap process_ids_; |
152 | 153 |
153 private: | 154 private: |
154 // Registers a site instance as hosting a given extension. | 155 // Registers a site instance as hosting a given extension. |
155 void RegisterExtensionSiteInstance(SiteInstance* site_instance, | 156 void RegisterExtensionSiteInstance(SiteInstance* site_instance, |
156 const Extension* extension); | 157 const Extension* extension); |
157 | 158 |
158 // Unregisters the extension associated with |site_instance|. | 159 // Unregisters the extension associated with |site_instance|. |
159 void UnregisterExtensionSiteInstance(SiteInstance* site_instance); | 160 void UnregisterExtensionSiteInstance(SiteInstance* site_instance); |
160 | 161 |
161 // Contains all extension-related RenderViewHost instances for all extensions. | 162 // Contains all extension-related RenderViewHost instances for all extensions. |
162 typedef std::set<RenderViewHost*> RenderViewHostSet; | 163 typedef std::set<RenderViewHost*> RenderViewHostSet; |
163 RenderViewHostSet all_extension_views_; | 164 RenderViewHostSet all_extension_views_; |
164 | 165 |
165 private: | 166 private: |
166 // Close the given |host| iff it's a background page. | 167 // Close the given |host| iff it's a background page. |
167 void CloseBackgroundHost(ExtensionHost* host); | 168 void CloseBackgroundHost(ExtensionHost* host); |
168 | 169 |
169 // Excludes background page. | 170 // Excludes background page. |
170 bool HasVisibleViews(const std::string& extension_id); | 171 bool HasVisibleViews(const std::string& extension_id); |
171 | 172 |
| 173 // Clears the mapping for the specified site instance. Returns the process the |
| 174 // site was mapped to, or -1 if it wasn't found. |
| 175 int ClearSiteInstanceID(int site_instance_id); |
| 176 |
172 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); | 177 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); |
173 }; | 178 }; |
174 | 179 |
175 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ | 180 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ |
OLD | NEW |