OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/guest_view/web_view/web_view_renderer_state.h" | 5 #include "chrome/browser/guest_view/web_view/web_view_renderer_state.h" |
6 #include "content/public/browser/browser_thread.h" | 6 #include "content/public/browser/browser_thread.h" |
7 | 7 |
8 using content::BrowserThread; | 8 using content::BrowserThread; |
9 | 9 |
10 // static | 10 // static |
11 WebViewRendererState* WebViewRendererState::GetInstance() { | 11 WebViewRendererState* WebViewRendererState::GetInstance() { |
12 return Singleton<WebViewRendererState>::get(); | 12 return Singleton<WebViewRendererState>::get(); |
13 } | 13 } |
14 | 14 |
15 WebViewRendererState::WebViewRendererState() { | 15 WebViewRendererState::WebViewRendererState() { |
16 } | 16 } |
17 | 17 |
18 WebViewRendererState::~WebViewRendererState() { | 18 WebViewRendererState::~WebViewRendererState() { |
19 } | 19 } |
20 | 20 |
21 bool WebViewRendererState::IsGuest(int render_process_id) { | 21 bool WebViewRendererState::IsGuest(int render_process_id) { |
22 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 22 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
23 return webview_partition_id_map_.find(render_process_id) != | 23 //return webview_partition_id_map_.find(render_process_id) != |
| 24 // webview_partition_id_map_.end(); |
| 25 bool ret = webview_partition_id_map_.find(render_process_id) != |
24 webview_partition_id_map_.end(); | 26 webview_partition_id_map_.end(); |
| 27 printf("WebViewRendererState::IsGuest: %d\n", ret); |
| 28 return ret; |
25 } | 29 } |
26 | 30 |
27 void WebViewRendererState::AddGuest(int guest_process_id, | 31 void WebViewRendererState::AddGuest(int guest_process_id, |
28 int guest_routing_id, | 32 int guest_routing_id, |
29 const WebViewInfo& webview_info) { | 33 const WebViewInfo& webview_info) { |
30 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 34 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 35 printf("AddGuest: gprocid: %d, groute_id: %d, partition_id: %s\n", |
| 36 guest_process_id, |
| 37 guest_routing_id, |
| 38 webview_info.partition_id.c_str()); |
31 RenderId render_id(guest_process_id, guest_routing_id); | 39 RenderId render_id(guest_process_id, guest_routing_id); |
32 webview_info_map_[render_id] = webview_info; | 40 webview_info_map_[render_id] = webview_info; |
33 WebViewPartitionIDMap::iterator iter = | 41 WebViewPartitionIDMap::iterator iter = |
34 webview_partition_id_map_.find(guest_process_id); | 42 webview_partition_id_map_.find(guest_process_id); |
35 if (iter != webview_partition_id_map_.end()) { | 43 if (iter != webview_partition_id_map_.end()) { |
36 ++iter->second.web_view_count; | 44 ++iter->second.web_view_count; |
37 return; | 45 return; |
38 } | 46 } |
39 WebViewPartitionInfo partition_info(1, webview_info.partition_id); | 47 WebViewPartitionInfo partition_info(1, webview_info.partition_id); |
40 webview_partition_id_map_[guest_process_id] = partition_info; | 48 webview_partition_id_map_[guest_process_id] = partition_info; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 std::string* partition_id) { | 80 std::string* partition_id) { |
73 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 81 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
74 WebViewPartitionIDMap::iterator iter = | 82 WebViewPartitionIDMap::iterator iter = |
75 webview_partition_id_map_.find(guest_process_id); | 83 webview_partition_id_map_.find(guest_process_id); |
76 if (iter != webview_partition_id_map_.end()) { | 84 if (iter != webview_partition_id_map_.end()) { |
77 *partition_id = iter->second.partition_id; | 85 *partition_id = iter->second.partition_id; |
78 return true; | 86 return true; |
79 } | 87 } |
80 return false; | 88 return false; |
81 } | 89 } |
OLD | NEW |