Chromium Code Reviews| Index: chrome/browser/extensions/extension_renderer_state.cc |
| diff --git a/chrome/browser/extensions/extension_renderer_state.cc b/chrome/browser/extensions/extension_renderer_state.cc |
| index 341db2788cc789e4cbde81f2b1df20f39716a7b5..b3a30f8950df470271e871912379cbc447262634 100644 |
| --- a/chrome/browser/extensions/extension_renderer_state.cc |
| +++ b/chrome/browser/extensions/extension_renderer_state.cc |
| @@ -223,12 +223,8 @@ bool ExtensionRendererState::GetTabAndWindowId( |
| bool ExtensionRendererState::IsWebViewRenderer(int render_process_id) { |
| DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| - for (WebViewInfoMap::iterator i = webview_info_map_.begin(); |
| - i != webview_info_map_.end(); ++i) { |
| - if (i->first.first == render_process_id) |
| - return true; |
| - } |
| - return false; |
| + return webview_partition_id_map_.find(render_process_id) != |
| + webview_partition_id_map_.end(); |
| } |
| void ExtensionRendererState::AddWebView(int guest_process_id, |
| @@ -237,6 +233,15 @@ void ExtensionRendererState::AddWebView(int guest_process_id, |
| DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| RenderId render_id(guest_process_id, guest_routing_id); |
| webview_info_map_[render_id] = webview_info; |
| + WebViewPartitionIDMap::iterator iter = |
| + webview_partition_id_map_.find(guest_process_id); |
| + if (iter != webview_partition_id_map_.end()) { |
| + WebViewPartitionInfo& partition_info = iter->second; |
| + ++partition_info.web_view_count; |
| + return; |
| + } |
| + WebViewPartitionInfo partition_info ={1, webview_info.partition_id}; |
|
Fady Samuel
2014/06/17 18:20:29
I can't find anything in the style guide that expl
Xi Han
2014/06/17 19:01:07
Done.
|
| + webview_partition_id_map_[guest_process_id] = partition_info; |
| } |
| void ExtensionRendererState::RemoveWebView(int guest_process_id, |
| @@ -244,6 +249,15 @@ void ExtensionRendererState::RemoveWebView(int guest_process_id, |
| DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| RenderId render_id(guest_process_id, guest_routing_id); |
| webview_info_map_.erase(render_id); |
| + WebViewPartitionIDMap::iterator iter = |
| + webview_partition_id_map_.find(guest_process_id); |
| + if (iter != webview_partition_id_map_.end() && |
| + iter->second.web_view_count > 1) { |
| + WebViewPartitionInfo& partition_info = iter->second; |
| + --partition_info.web_view_count; |
| + return; |
| + } |
| + webview_partition_id_map_.erase(guest_process_id); |
| } |
| bool ExtensionRendererState::GetWebViewInfo(int guest_process_id, |
| @@ -258,3 +272,15 @@ bool ExtensionRendererState::GetWebViewInfo(int guest_process_id, |
| } |
| return false; |
| } |
| + |
| +bool ExtensionRendererState::GetWebViewPartitionID(int guest_process_id, |
| + std::string* partition_id) { |
| + DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| + WebViewPartitionIDMap::iterator iter = |
| + webview_partition_id_map_.find(guest_process_id); |
| + if (iter != webview_partition_id_map_.end()) { |
| + *partition_id = iter->second.partition_id; |
| + return true; |
| + } |
| + return false; |
| +} |