| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
| 6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
| 7 | 7 |
| 8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 #include "content/browser/renderer_host/render_view_host_delegate.h" | 76 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 77 #include "content/browser/renderer_host/render_view_host_impl.h" | 77 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 78 #include "content/browser/renderer_host/render_widget_helper.h" | 78 #include "content/browser/renderer_host/render_widget_helper.h" |
| 79 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" | 79 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" |
| 80 #include "content/browser/renderer_host/text_input_client_message_filter.h" | 80 #include "content/browser/renderer_host/text_input_client_message_filter.h" |
| 81 #include "content/browser/resolve_proxy_msg_helper.h" | 81 #include "content/browser/resolve_proxy_msg_helper.h" |
| 82 #include "content/browser/storage_partition_impl.h" | 82 #include "content/browser/storage_partition_impl.h" |
| 83 #include "content/browser/speech/input_tag_speech_dispatcher_host.h" | 83 #include "content/browser/speech/input_tag_speech_dispatcher_host.h" |
| 84 #include "content/browser/speech/speech_recognition_dispatcher_host.h" | 84 #include "content/browser/speech/speech_recognition_dispatcher_host.h" |
| 85 #include "content/browser/trace_message_filter.h" | 85 #include "content/browser/trace_message_filter.h" |
| 86 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
| 86 #include "content/browser/worker_host/worker_storage_partition.h" | 87 #include "content/browser/worker_host/worker_storage_partition.h" |
| 87 #include "content/browser/worker_host/worker_message_filter.h" | 88 #include "content/browser/worker_host/worker_message_filter.h" |
| 88 #include "content/common/child_process_host_impl.h" | 89 #include "content/common/child_process_host_impl.h" |
| 89 #include "content/common/child_process_messages.h" | 90 #include "content/common/child_process_messages.h" |
| 90 #include "content/common/gpu/gpu_messages.h" | 91 #include "content/common/gpu/gpu_messages.h" |
| 91 #include "content/common/resource_messages.h" | 92 #include "content/common/resource_messages.h" |
| 92 #include "content/common/view_messages.h" | 93 #include "content/common/view_messages.h" |
| 93 #include "content/public/browser/browser_context.h" | 94 #include "content/public/browser/browser_context.h" |
| 94 #include "content/public/browser/content_browser_client.h" | 95 #include "content/public/browser/content_browser_client.h" |
| 95 #include "content/public/browser/notification_service.h" | 96 #include "content/public/browser/notification_service.h" |
| 96 #include "content/public/browser/notification_types.h" | 97 #include "content/public/browser/notification_types.h" |
| 97 #include "content/public/browser/render_process_host_factory.h" | 98 #include "content/public/browser/render_process_host_factory.h" |
| 98 #include "content/public/browser/resource_context.h" | 99 #include "content/public/browser/resource_context.h" |
| 99 #include "content/public/browser/user_metrics.h" | 100 #include "content/public/browser/user_metrics.h" |
| 100 #include "content/public/browser/web_ui_controller_factory.h" | |
| 101 #include "content/public/common/content_constants.h" | 101 #include "content/public/common/content_constants.h" |
| 102 #include "content/public/common/content_switches.h" | 102 #include "content/public/common/content_switches.h" |
| 103 #include "content/public/common/process_type.h" | 103 #include "content/public/common/process_type.h" |
| 104 #include "content/public/common/result_codes.h" | 104 #include "content/public/common/result_codes.h" |
| 105 #include "content/public/common/url_constants.h" | 105 #include "content/public/common/url_constants.h" |
| 106 #include "content/renderer/render_process_impl.h" | 106 #include "content/renderer/render_process_impl.h" |
| 107 #include "content/renderer/render_thread_impl.h" | 107 #include "content/renderer/render_thread_impl.h" |
| 108 #include "ipc/ipc_channel.h" | 108 #include "ipc/ipc_channel.h" |
| 109 #include "ipc/ipc_logging.h" | 109 #include "ipc/ipc_logging.h" |
| 110 #include "ipc/ipc_platform_file.h" | 110 #include "ipc/ipc_platform_file.h" |
| (...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1261 // All URLs are suitable if this is associated with a guest renderer process. | 1261 // All URLs are suitable if this is associated with a guest renderer process. |
| 1262 // TODO(fsamuel, creis): Further validation is needed to ensure that only | 1262 // TODO(fsamuel, creis): Further validation is needed to ensure that only |
| 1263 // normal web URLs are permitted in guest processes. We need to investigate | 1263 // normal web URLs are permitted in guest processes. We need to investigate |
| 1264 // where this validation should happen. | 1264 // where this validation should happen. |
| 1265 if (host->IsGuest()) | 1265 if (host->IsGuest()) |
| 1266 return true; | 1266 return true; |
| 1267 | 1267 |
| 1268 if (!host->IsGuest() && site_url.SchemeIs(chrome::kGuestScheme)) | 1268 if (!host->IsGuest() && site_url.SchemeIs(chrome::kGuestScheme)) |
| 1269 return false; | 1269 return false; |
| 1270 | 1270 |
| 1271 WebUIControllerFactory* factory = | 1271 if (ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings( |
| 1272 GetContentClient()->browser()->GetWebUIControllerFactory(); | |
| 1273 if (factory && | |
| 1274 ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings( | |
| 1275 host->GetID()) != | 1272 host->GetID()) != |
| 1276 factory->UseWebUIBindingsForURL(browser_context, site_url)) { | 1273 WebUIControllerFactoryRegistry::GetInstance()->UseWebUIBindingsForURL( |
| 1274 browser_context, site_url)) { |
| 1277 return false; | 1275 return false; |
| 1278 } | 1276 } |
| 1279 | 1277 |
| 1280 return GetContentClient()->browser()->IsSuitableHost(host, site_url); | 1278 return GetContentClient()->browser()->IsSuitableHost(host, site_url); |
| 1281 } | 1279 } |
| 1282 | 1280 |
| 1283 // static | 1281 // static |
| 1284 bool RenderProcessHost::run_renderer_in_process() { | 1282 bool RenderProcessHost::run_renderer_in_process() { |
| 1285 return g_run_renderer_in_process_; | 1283 return g_run_renderer_in_process_; |
| 1286 } | 1284 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1382 // We want to consolidate particular sites like WebUI when we are using | 1380 // We want to consolidate particular sites like WebUI when we are using |
| 1383 // process-per-tab or process-per-site-instance models. | 1381 // process-per-tab or process-per-site-instance models. |
| 1384 // Note that --single-process is handled in ShouldTryToUseExistingProcessHost. | 1382 // Note that --single-process is handled in ShouldTryToUseExistingProcessHost. |
| 1385 | 1383 |
| 1386 if (GetContentClient()->browser()-> | 1384 if (GetContentClient()->browser()-> |
| 1387 ShouldUseProcessPerSite(browser_context, url)) { | 1385 ShouldUseProcessPerSite(browser_context, url)) { |
| 1388 return true; | 1386 return true; |
| 1389 } | 1387 } |
| 1390 | 1388 |
| 1391 // DevTools pages have WebUI type but should not reuse the same host. | 1389 // DevTools pages have WebUI type but should not reuse the same host. |
| 1392 WebUIControllerFactory* factory = | 1390 if (WebUIControllerFactoryRegistry::GetInstance()->UseWebUIForURL( |
| 1393 GetContentClient()->browser()->GetWebUIControllerFactory(); | 1391 browser_context, url) && |
| 1394 if (factory && | |
| 1395 factory->UseWebUIForURL(browser_context, url) && | |
| 1396 !url.SchemeIs(chrome::kChromeDevToolsScheme)) { | 1392 !url.SchemeIs(chrome::kChromeDevToolsScheme)) { |
| 1397 return true; | 1393 return true; |
| 1398 } | 1394 } |
| 1399 | 1395 |
| 1400 // In all other cases, don't use process-per-site logic. | 1396 // In all other cases, don't use process-per-site logic. |
| 1401 return false; | 1397 return false; |
| 1402 } | 1398 } |
| 1403 | 1399 |
| 1404 // static | 1400 // static |
| 1405 RenderProcessHost* RenderProcessHostImpl::GetProcessHostForSite( | 1401 RenderProcessHost* RenderProcessHostImpl::GetProcessHostForSite( |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1599 TRACE_EVENT0("renderer_host", | 1595 TRACE_EVENT0("renderer_host", |
| 1600 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); | 1596 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); |
| 1601 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 1597 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
| 1602 ack_params.sync_point = 0; | 1598 ack_params.sync_point = 0; |
| 1603 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, | 1599 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, |
| 1604 gpu_process_host_id, | 1600 gpu_process_host_id, |
| 1605 ack_params); | 1601 ack_params); |
| 1606 } | 1602 } |
| 1607 | 1603 |
| 1608 } // namespace content | 1604 } // namespace content |
| OLD | NEW |