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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 #include "content/browser/gpu/compositor_util.h" | 78 #include "content/browser/gpu/compositor_util.h" |
79 #include "content/browser/gpu/gpu_client.h" | 79 #include "content/browser/gpu/gpu_client.h" |
80 #include "content/browser/gpu/gpu_data_manager_impl.h" | 80 #include "content/browser/gpu/gpu_data_manager_impl.h" |
81 #include "content/browser/gpu/gpu_process_host.h" | 81 #include "content/browser/gpu/gpu_process_host.h" |
82 #include "content/browser/gpu/shader_cache_factory.h" | 82 #include "content/browser/gpu/shader_cache_factory.h" |
83 #include "content/browser/histogram_message_filter.h" | 83 #include "content/browser/histogram_message_filter.h" |
84 #include "content/browser/image_capture/image_capture_impl.h" | 84 #include "content/browser/image_capture/image_capture_impl.h" |
85 #include "content/browser/indexed_db/indexed_db_context_impl.h" | 85 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
86 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h" | 86 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h" |
87 #include "content/browser/loader/resource_message_filter.h" | 87 #include "content/browser/loader/resource_message_filter.h" |
| 88 #include "content/browser/loader/resource_requester_info.h" |
88 #include "content/browser/loader/resource_scheduler_filter.h" | 89 #include "content/browser/loader/resource_scheduler_filter.h" |
89 #include "content/browser/loader/url_loader_factory_impl.h" | 90 #include "content/browser/loader/url_loader_factory_impl.h" |
90 #include "content/browser/media/capture/audio_mirroring_manager.h" | 91 #include "content/browser/media/capture/audio_mirroring_manager.h" |
91 #include "content/browser/media/media_internals.h" | 92 #include "content/browser/media/media_internals.h" |
92 #include "content/browser/media/midi_host.h" | 93 #include "content/browser/media/midi_host.h" |
93 #include "content/browser/memory/memory_coordinator_impl.h" | 94 #include "content/browser/memory/memory_coordinator_impl.h" |
94 #include "content/browser/memory/memory_message_filter.h" | 95 #include "content/browser/memory/memory_message_filter.h" |
95 #include "content/browser/mime_registry_impl.h" | 96 #include "content/browser/mime_registry_impl.h" |
96 #include "content/browser/notifications/notification_message_filter.h" | 97 #include "content/browser/notifications/notification_message_filter.h" |
97 #include "content/browser/notifications/platform_notification_context_impl.h" | 98 #include "content/browser/notifications/platform_notification_context_impl.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 #include "content/common/child_process_messages.h" | 136 #include "content/common/child_process_messages.h" |
136 #include "content/common/content_switches_internal.h" | 137 #include "content/common/content_switches_internal.h" |
137 #include "content/common/frame_messages.h" | 138 #include "content/common/frame_messages.h" |
138 #include "content/common/in_process_child_thread_params.h" | 139 #include "content/common/in_process_child_thread_params.h" |
139 #include "content/common/render_process_messages.h" | 140 #include "content/common/render_process_messages.h" |
140 #include "content/common/resource_messages.h" | 141 #include "content/common/resource_messages.h" |
141 #include "content/common/service_manager/child_connection.h" | 142 #include "content/common/service_manager/child_connection.h" |
142 #include "content/common/service_manager/service_manager_connection_impl.h" | 143 #include "content/common/service_manager/service_manager_connection_impl.h" |
143 #include "content/common/site_isolation_policy.h" | 144 #include "content/common/site_isolation_policy.h" |
144 #include "content/common/view_messages.h" | 145 #include "content/common/view_messages.h" |
| 146 #include "content/common/worker_fetch_context_factory.mojom.h" |
145 #include "content/public/browser/browser_context.h" | 147 #include "content/public/browser/browser_context.h" |
146 #include "content/public/browser/browser_thread.h" | 148 #include "content/public/browser/browser_thread.h" |
147 #include "content/public/browser/content_browser_client.h" | 149 #include "content/public/browser/content_browser_client.h" |
148 #include "content/public/browser/notification_service.h" | 150 #include "content/public/browser/notification_service.h" |
149 #include "content/public/browser/notification_types.h" | 151 #include "content/public/browser/notification_types.h" |
150 #include "content/public/browser/render_process_host_factory.h" | 152 #include "content/public/browser/render_process_host_factory.h" |
151 #include "content/public/browser/render_process_host_observer.h" | 153 #include "content/public/browser/render_process_host_observer.h" |
152 #include "content/public/browser/render_widget_host.h" | 154 #include "content/public/browser/render_widget_host.h" |
153 #include "content/public/browser/render_widget_host_iterator.h" | 155 #include "content/public/browser/render_widget_host_iterator.h" |
154 #include "content/public/browser/resource_context.h" | 156 #include "content/public/browser/resource_context.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 // Forwards service requests to Service Manager since the renderer cannot launch | 468 // Forwards service requests to Service Manager since the renderer cannot launch |
467 // out-of-process services on is own. | 469 // out-of-process services on is own. |
468 template <typename R> | 470 template <typename R> |
469 void ForwardShapeDetectionRequest(R request) { | 471 void ForwardShapeDetectionRequest(R request) { |
470 service_manager::Connector* connector = | 472 service_manager::Connector* connector = |
471 ServiceManagerConnection::GetForProcess()->GetConnector(); | 473 ServiceManagerConnection::GetForProcess()->GetConnector(); |
472 connector->BindInterface(shape_detection::mojom::kServiceName, | 474 connector->BindInterface(shape_detection::mojom::kServiceName, |
473 std::move(request)); | 475 std::move(request)); |
474 } | 476 } |
475 | 477 |
| 478 class WorkerFetchContextFactoryImpl : public mojom::WorkerFetchContextFactory { |
| 479 public: |
| 480 static void Create( |
| 481 int render_process_id, |
| 482 ResourceMessageFilter* resource_message_filter, |
| 483 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context, |
| 484 mojom::WorkerFetchContextFactoryRequest request) { |
| 485 DCHECK(base::FeatureList::IsEnabled(features::kOffMainThreadFetch)); |
| 486 mojo::MakeStrongBinding( |
| 487 base::MakeUnique<WorkerFetchContextFactoryImpl>( |
| 488 render_process_id, resource_message_filter->GetWeakPtr(), |
| 489 std::move(service_worker_context)), |
| 490 std::move(request)); |
| 491 } |
| 492 WorkerFetchContextFactoryImpl( |
| 493 int render_process_id, |
| 494 base::WeakPtr<ResourceMessageFilter> resource_message_filter, |
| 495 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context) |
| 496 : render_process_id_(render_process_id), |
| 497 url_loader_factory_binding_(resource_message_filter.get()), |
| 498 service_worker_context_(std::move(service_worker_context)) {} |
| 499 ~WorkerFetchContextFactoryImpl() override {} |
| 500 |
| 501 void CreateWorkerFetchContext( |
| 502 mojom::URLLoaderFactoryAssociatedRequest loader_request, |
| 503 mojom::ServiceWorkerClientAssociatedPtrInfo client_ptr_info, |
| 504 int service_worker_provider_id) override { |
| 505 url_loader_factory_binding_.Bind(std::move(loader_request)); |
| 506 service_worker_context_->BindWorkerFetchContext(render_process_id_, |
| 507 service_worker_provider_id, |
| 508 std::move(client_ptr_info)); |
| 509 }; |
| 510 void GetURLLoaderFactory( |
| 511 mojom::URLLoaderFactoryAssociatedRequest loader_request) override { |
| 512 url_loader_factory_binding_.Bind(std::move(loader_request)); |
| 513 } |
| 514 |
| 515 private: |
| 516 const int render_process_id_; |
| 517 mojo::AssociatedBinding<mojom::URLLoaderFactory> url_loader_factory_binding_; |
| 518 |
| 519 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; |
| 520 }; |
| 521 |
476 } // namespace | 522 } // namespace |
477 | 523 |
478 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL; | 524 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL; |
479 | 525 |
480 base::MessageLoop* g_in_process_thread; | 526 base::MessageLoop* g_in_process_thread; |
481 | 527 |
482 // Stores the maximum number of renderer processes the content module can | 528 // Stores the maximum number of renderer processes the content module can |
483 // create. | 529 // create. |
484 static size_t g_max_renderer_count_override = 0; | 530 static size_t g_max_renderer_count_override = 0; |
485 | 531 |
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 make_scoped_refptr( | 1333 make_scoped_refptr( |
1288 storage_partition_impl_->GetBackgroundFetchContext()))); | 1334 storage_partition_impl_->GetBackgroundFetchContext()))); |
1289 | 1335 |
1290 registry->AddInterface(base::Bind(&RenderProcessHostImpl::CreateMusGpuRequest, | 1336 registry->AddInterface(base::Bind(&RenderProcessHostImpl::CreateMusGpuRequest, |
1291 base::Unretained(this))); | 1337 base::Unretained(this))); |
1292 | 1338 |
1293 registry->AddInterface( | 1339 registry->AddInterface( |
1294 base::Bind(&VideoCaptureHost::Create, | 1340 base::Bind(&VideoCaptureHost::Create, |
1295 BrowserMainLoop::GetInstance()->media_stream_manager())); | 1341 BrowserMainLoop::GetInstance()->media_stream_manager())); |
1296 | 1342 |
| 1343 if (base::FeatureList::IsEnabled(features::kOffMainThreadFetch)) { |
| 1344 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context( |
| 1345 static_cast<ServiceWorkerContextWrapper*>( |
| 1346 storage_partition_impl_->GetServiceWorkerContext())); |
| 1347 registry->AddInterface( |
| 1348 base::Bind(&WorkerFetchContextFactoryImpl::Create, GetID(), |
| 1349 base::Unretained(resource_message_filter_.get()), |
| 1350 service_worker_context)); |
| 1351 } |
| 1352 |
1297 // This is to support usage of WebSockets in cases in which there is no | 1353 // This is to support usage of WebSockets in cases in which there is no |
1298 // associated RenderFrame (e.g., Shared Workers). | 1354 // associated RenderFrame (e.g., Shared Workers). |
1299 AddUIThreadInterface( | 1355 AddUIThreadInterface( |
1300 registry.get(), base::Bind(&WebSocketManager::CreateWebSocket, GetID(), | 1356 registry.get(), base::Bind(&WebSocketManager::CreateWebSocket, GetID(), |
1301 MSG_ROUTING_NONE)); | 1357 MSG_ROUTING_NONE)); |
1302 | 1358 |
1303 // Chrome browser process only provides DiscardableSharedMemory service when | 1359 // Chrome browser process only provides DiscardableSharedMemory service when |
1304 // Chrome is not running in mus+ash. | 1360 // Chrome is not running in mus+ash. |
1305 if (!service_manager::ServiceManagerIsRemote()) { | 1361 if (!service_manager::ServiceManagerIsRemote()) { |
1306 discardable_memory::DiscardableSharedMemoryManager* manager = | 1362 discardable_memory::DiscardableSharedMemoryManager* manager = |
(...skipping 1751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3058 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 3114 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
3059 | 3115 |
3060 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. | 3116 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. |
3061 // Capture the error message in a crash key value. | 3117 // Capture the error message in a crash key value. |
3062 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); | 3118 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); |
3063 bad_message::ReceivedBadMessage(render_process_id, | 3119 bad_message::ReceivedBadMessage(render_process_id, |
3064 bad_message::RPH_MOJO_PROCESS_ERROR); | 3120 bad_message::RPH_MOJO_PROCESS_ERROR); |
3065 } | 3121 } |
3066 | 3122 |
3067 } // namespace content | 3123 } // namespace content |
OLD | NEW |