| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 #include "ipc/ipc_channel.h" | 179 #include "ipc/ipc_channel.h" |
| 180 #include "ipc/ipc_channel_mojo.h" | 180 #include "ipc/ipc_channel_mojo.h" |
| 181 #include "ipc/ipc_logging.h" | 181 #include "ipc/ipc_logging.h" |
| 182 #include "media/base/media_switches.h" | 182 #include "media/base/media_switches.h" |
| 183 #include "media/media_features.h" | 183 #include "media/media_features.h" |
| 184 #include "mojo/edk/embedder/embedder.h" | 184 #include "mojo/edk/embedder/embedder.h" |
| 185 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" | 185 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" |
| 186 #include "mojo/public/cpp/bindings/strong_binding.h" | 186 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 187 #include "net/url_request/url_request_context_getter.h" | 187 #include "net/url_request/url_request_context_getter.h" |
| 188 #include "ppapi/features/features.h" | 188 #include "ppapi/features/features.h" |
| 189 #include "services/resource_coordinator/public/cpp/resource_coordinator_features
.h" |
| 189 #include "services/resource_coordinator/public/cpp/resource_coordinator_interfac
e.h" | 190 #include "services/resource_coordinator/public/cpp/resource_coordinator_interfac
e.h" |
| 190 #include "services/service_manager/embedder/switches.h" | 191 #include "services/service_manager/embedder/switches.h" |
| 191 #include "services/service_manager/public/cpp/binder_registry.h" | 192 #include "services/service_manager/public/cpp/binder_registry.h" |
| 192 #include "services/service_manager/public/cpp/connector.h" | 193 #include "services/service_manager/public/cpp/connector.h" |
| 193 #include "services/service_manager/public/cpp/interface_provider.h" | 194 #include "services/service_manager/public/cpp/interface_provider.h" |
| 194 #include "services/service_manager/runner/common/client_util.h" | 195 #include "services/service_manager/runner/common/client_util.h" |
| 195 #include "services/service_manager/runner/common/switches.h" | 196 #include "services/service_manager/runner/common/switches.h" |
| 196 #include "services/shape_detection/public/interfaces/barcodedetection.mojom.h" | 197 #include "services/shape_detection/public/interfaces/barcodedetection.mojom.h" |
| 197 #include "services/shape_detection/public/interfaces/constants.mojom.h" | 198 #include "services/shape_detection/public/interfaces/constants.mojom.h" |
| 198 #include "services/shape_detection/public/interfaces/facedetection_provider.mojo
m.h" | 199 #include "services/shape_detection/public/interfaces/facedetection_provider.mojo
m.h" |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 }; | 522 }; |
| 522 | 523 |
| 523 void CreateMemoryCoordinatorHandle( | 524 void CreateMemoryCoordinatorHandle( |
| 524 int render_process_id, | 525 int render_process_id, |
| 525 const service_manager::BindSourceInfo& source_info, | 526 const service_manager::BindSourceInfo& source_info, |
| 526 mojom::MemoryCoordinatorHandleRequest request) { | 527 mojom::MemoryCoordinatorHandleRequest request) { |
| 527 MemoryCoordinatorImpl::GetInstance()->CreateHandle(render_process_id, | 528 MemoryCoordinatorImpl::GetInstance()->CreateHandle(render_process_id, |
| 528 std::move(request)); | 529 std::move(request)); |
| 529 } | 530 } |
| 530 | 531 |
| 532 void CreateResourceCoordinatorProcessInterface( |
| 533 RenderProcessHostImpl* render_process_host, |
| 534 const service_manager::BindSourceInfo& source_info, |
| 535 resource_coordinator::mojom::CoordinationUnitRequest request) { |
| 536 render_process_host->GetProcessResourceCoordinator()->service()->AddBinding( |
| 537 std::move(request)); |
| 538 } |
| 539 |
| 531 // Forwards service requests to Service Manager since the renderer cannot launch | 540 // Forwards service requests to Service Manager since the renderer cannot launch |
| 532 // out-of-process services on is own. | 541 // out-of-process services on is own. |
| 533 template <typename R> | 542 template <typename R> |
| 534 void ForwardShapeDetectionRequest(const service_manager::BindSourceInfo&, | 543 void ForwardShapeDetectionRequest(const service_manager::BindSourceInfo&, |
| 535 R request) { | 544 R request) { |
| 536 // TODO(beng): This should really be using the per-profile connector. | 545 // TODO(beng): This should really be using the per-profile connector. |
| 537 service_manager::Connector* connector = | 546 service_manager::Connector* connector = |
| 538 ServiceManagerConnection::GetForProcess()->GetConnector(); | 547 ServiceManagerConnection::GetForProcess()->GetConnector(); |
| 539 connector->BindInterface(shape_detection::mojom::kServiceName, | 548 connector->BindInterface(shape_detection::mojom::kServiceName, |
| 540 std::move(request)); | 549 std::move(request)); |
| (...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1655 registry->AddInterface(base::Bind(&RenderProcessHostImpl::CreateMusGpuRequest, | 1664 registry->AddInterface(base::Bind(&RenderProcessHostImpl::CreateMusGpuRequest, |
| 1656 base::Unretained(this))); | 1665 base::Unretained(this))); |
| 1657 | 1666 |
| 1658 registry->AddInterface( | 1667 registry->AddInterface( |
| 1659 base::Bind(&VideoCaptureHost::Create, | 1668 base::Bind(&VideoCaptureHost::Create, |
| 1660 BrowserMainLoop::GetInstance()->media_stream_manager())); | 1669 BrowserMainLoop::GetInstance()->media_stream_manager())); |
| 1661 | 1670 |
| 1662 registry->AddInterface( | 1671 registry->AddInterface( |
| 1663 base::Bind(&metrics::CreateSingleSampleMetricsProvider)); | 1672 base::Bind(&metrics::CreateSingleSampleMetricsProvider)); |
| 1664 | 1673 |
| 1674 if (base::FeatureList::IsEnabled(features::kGlobalResourceCoordinator)) { |
| 1675 registry->AddInterface(base::Bind( |
| 1676 &CreateResourceCoordinatorProcessInterface, base::Unretained(this))); |
| 1677 } |
| 1678 |
| 1665 if (base::FeatureList::IsEnabled(features::kOffMainThreadFetch)) { | 1679 if (base::FeatureList::IsEnabled(features::kOffMainThreadFetch)) { |
| 1666 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context( | 1680 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context( |
| 1667 static_cast<ServiceWorkerContextWrapper*>( | 1681 static_cast<ServiceWorkerContextWrapper*>( |
| 1668 storage_partition_impl_->GetServiceWorkerContext())); | 1682 storage_partition_impl_->GetServiceWorkerContext())); |
| 1669 registry->AddInterface( | 1683 registry->AddInterface( |
| 1670 base::Bind(&WorkerURLLoaderFactoryProviderImpl::Create, GetID(), | 1684 base::Bind(&WorkerURLLoaderFactoryProviderImpl::Create, GetID(), |
| 1671 resource_message_filter_, service_worker_context)); | 1685 resource_message_filter_, service_worker_context)); |
| 1672 } | 1686 } |
| 1673 | 1687 |
| 1674 // This is to support usage of WebSockets in cases in which there is no | 1688 // This is to support usage of WebSockets in cases in which there is no |
| (...skipping 2112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3787 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 3801 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
| 3788 | 3802 |
| 3789 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. | 3803 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. |
| 3790 // Capture the error message in a crash key value. | 3804 // Capture the error message in a crash key value. |
| 3791 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); | 3805 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); |
| 3792 bad_message::ReceivedBadMessage(render_process_id, | 3806 bad_message::ReceivedBadMessage(render_process_id, |
| 3793 bad_message::RPH_MOJO_PROCESS_ERROR); | 3807 bad_message::RPH_MOJO_PROCESS_ERROR); |
| 3794 } | 3808 } |
| 3795 | 3809 |
| 3796 } // namespace content | 3810 } // namespace content |
| OLD | NEW |