| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 #include "content/browser/storage_partition_impl.h" | 130 #include "content/browser/storage_partition_impl.h" |
| 131 #include "content/browser/streams/stream_context.h" | 131 #include "content/browser/streams/stream_context.h" |
| 132 #include "content/browser/tracing/trace_message_filter.h" | 132 #include "content/browser/tracing/trace_message_filter.h" |
| 133 #include "content/browser/websockets/websocket_manager.h" | 133 #include "content/browser/websockets/websocket_manager.h" |
| 134 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 134 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
| 135 #include "content/common/child_process_host_impl.h" | 135 #include "content/common/child_process_host_impl.h" |
| 136 #include "content/common/child_process_messages.h" | 136 #include "content/common/child_process_messages.h" |
| 137 #include "content/common/content_switches_internal.h" | 137 #include "content/common/content_switches_internal.h" |
| 138 #include "content/common/frame_messages.h" | 138 #include "content/common/frame_messages.h" |
| 139 #include "content/common/in_process_child_thread_params.h" | 139 #include "content/common/in_process_child_thread_params.h" |
| 140 #include "content/common/network_service.mojom.h" |
| 140 #include "content/common/render_process_messages.h" | 141 #include "content/common/render_process_messages.h" |
| 141 #include "content/common/resource_messages.h" | 142 #include "content/common/resource_messages.h" |
| 142 #include "content/common/service_manager/child_connection.h" | 143 #include "content/common/service_manager/child_connection.h" |
| 143 #include "content/common/service_manager/service_manager_connection_impl.h" | 144 #include "content/common/service_manager/service_manager_connection_impl.h" |
| 144 #include "content/common/site_isolation_policy.h" | 145 #include "content/common/site_isolation_policy.h" |
| 145 #include "content/common/view_messages.h" | 146 #include "content/common/view_messages.h" |
| 146 #include "content/common/worker_url_loader_factory_provider.mojom.h" | 147 #include "content/common/worker_url_loader_factory_provider.mojom.h" |
| 147 #include "content/public/browser/browser_context.h" | 148 #include "content/public/browser/browser_context.h" |
| 148 #include "content/public/browser/browser_thread.h" | 149 #include "content/public/browser/browser_thread.h" |
| 149 #include "content/public/browser/content_browser_client.h" | 150 #include "content/public/browser/content_browser_client.h" |
| (...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1408 | 1409 |
| 1409 AddUIThreadInterface(registry.get(), base::Bind(&FieldTrialRecorder::Create)); | 1410 AddUIThreadInterface(registry.get(), base::Bind(&FieldTrialRecorder::Create)); |
| 1410 | 1411 |
| 1411 associated_interfaces_.reset(new AssociatedInterfaceRegistryImpl()); | 1412 associated_interfaces_.reset(new AssociatedInterfaceRegistryImpl()); |
| 1412 GetContentClient()->browser()->ExposeInterfacesToRenderer( | 1413 GetContentClient()->browser()->ExposeInterfacesToRenderer( |
| 1413 registry.get(), associated_interfaces_.get(), this); | 1414 registry.get(), associated_interfaces_.get(), this); |
| 1414 static_cast<AssociatedInterfaceRegistry*>(associated_interfaces_.get()) | 1415 static_cast<AssociatedInterfaceRegistry*>(associated_interfaces_.get()) |
| 1415 ->AddInterface(base::Bind(&RenderProcessHostImpl::BindRouteProvider, | 1416 ->AddInterface(base::Bind(&RenderProcessHostImpl::BindRouteProvider, |
| 1416 base::Unretained(this))); | 1417 base::Unretained(this))); |
| 1417 | 1418 |
| 1419 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1420 switches::kEnableNetworkService)) { |
| 1421 AddUIThreadInterface( |
| 1422 registry.get(), |
| 1423 base::Bind(&RenderProcessHostImpl::CreateURLLoaderFactory, |
| 1424 base::Unretained(this))); |
| 1425 } |
| 1426 |
| 1418 ServiceManagerConnection* service_manager_connection = | 1427 ServiceManagerConnection* service_manager_connection = |
| 1419 BrowserContext::GetServiceManagerConnectionFor(browser_context_); | 1428 BrowserContext::GetServiceManagerConnectionFor(browser_context_); |
| 1420 std::unique_ptr<ConnectionFilterImpl> connection_filter( | 1429 std::unique_ptr<ConnectionFilterImpl> connection_filter( |
| 1421 new ConnectionFilterImpl(child_connection_->child_identity(), | 1430 new ConnectionFilterImpl(child_connection_->child_identity(), |
| 1422 std::move(registry))); | 1431 std::move(registry))); |
| 1423 connection_filter_controller_ = connection_filter->controller(); | 1432 connection_filter_controller_ = connection_filter->controller(); |
| 1424 connection_filter_id_ = service_manager_connection->AddConnectionFilter( | 1433 connection_filter_id_ = service_manager_connection->AddConnectionFilter( |
| 1425 std::move(connection_filter)); | 1434 std::move(connection_filter)); |
| 1426 } | 1435 } |
| 1427 | 1436 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1481 void RenderProcessHostImpl::CreateStoragePartitionService( | 1490 void RenderProcessHostImpl::CreateStoragePartitionService( |
| 1482 const service_manager::BindSourceInfo& source_info, | 1491 const service_manager::BindSourceInfo& source_info, |
| 1483 mojom::StoragePartitionServiceRequest request) { | 1492 mojom::StoragePartitionServiceRequest request) { |
| 1484 // DO NOT REMOVE THIS COMMAND LINE CHECK WITHOUT SECURITY REVIEW! | 1493 // DO NOT REMOVE THIS COMMAND LINE CHECK WITHOUT SECURITY REVIEW! |
| 1485 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1494 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1486 switches::kMojoLocalStorage)) { | 1495 switches::kMojoLocalStorage)) { |
| 1487 storage_partition_impl_->Bind(std::move(request)); | 1496 storage_partition_impl_->Bind(std::move(request)); |
| 1488 } | 1497 } |
| 1489 } | 1498 } |
| 1490 | 1499 |
| 1500 void RenderProcessHostImpl::CreateURLLoaderFactory( |
| 1501 const service_manager::BindSourceInfo& source_info, |
| 1502 mojom::URLLoaderFactoryRequest request) { |
| 1503 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1504 switches::kEnableNetworkService)) { |
| 1505 NOTREACHED(); |
| 1506 return; |
| 1507 } |
| 1508 storage_partition_impl_->network_context()->CreateURLLoaderFactory( |
| 1509 std::move(request), id_); |
| 1510 } |
| 1511 |
| 1491 int RenderProcessHostImpl::GetNextRoutingID() { | 1512 int RenderProcessHostImpl::GetNextRoutingID() { |
| 1492 return widget_helper_->GetNextRoutingID(); | 1513 return widget_helper_->GetNextRoutingID(); |
| 1493 } | 1514 } |
| 1494 | 1515 |
| 1495 void RenderProcessHostImpl::ResumeDeferredNavigation( | 1516 void RenderProcessHostImpl::ResumeDeferredNavigation( |
| 1496 const GlobalRequestID& request_id) { | 1517 const GlobalRequestID& request_id) { |
| 1497 widget_helper_->ResumeDeferredNavigation(request_id); | 1518 widget_helper_->ResumeDeferredNavigation(request_id); |
| 1498 } | 1519 } |
| 1499 | 1520 |
| 1500 void RenderProcessHostImpl::BindInterface( | 1521 void RenderProcessHostImpl::BindInterface( |
| (...skipping 1769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3270 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 3291 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
| 3271 | 3292 |
| 3272 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. | 3293 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. |
| 3273 // Capture the error message in a crash key value. | 3294 // Capture the error message in a crash key value. |
| 3274 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); | 3295 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); |
| 3275 bad_message::ReceivedBadMessage(render_process_id, | 3296 bad_message::ReceivedBadMessage(render_process_id, |
| 3276 bad_message::RPH_MOJO_PROCESS_ERROR); | 3297 bad_message::RPH_MOJO_PROCESS_ERROR); |
| 3277 } | 3298 } |
| 3278 | 3299 |
| 3279 } // namespace content | 3300 } // namespace content |
| OLD | NEW |