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 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1133 AddFilter(message_port_message_filter_.get()); | 1133 AddFilter(message_port_message_filter_.get()); |
1134 | 1134 |
1135 scoped_refptr<CacheStorageDispatcherHost> cache_storage_filter = | 1135 scoped_refptr<CacheStorageDispatcherHost> cache_storage_filter = |
1136 new CacheStorageDispatcherHost(); | 1136 new CacheStorageDispatcherHost(); |
1137 cache_storage_filter->Init(storage_partition_impl_->GetCacheStorageContext()); | 1137 cache_storage_filter->Init(storage_partition_impl_->GetCacheStorageContext()); |
1138 AddFilter(cache_storage_filter.get()); | 1138 AddFilter(cache_storage_filter.get()); |
1139 | 1139 |
1140 scoped_refptr<ServiceWorkerDispatcherHost> service_worker_filter = | 1140 scoped_refptr<ServiceWorkerDispatcherHost> service_worker_filter = |
1141 new ServiceWorkerDispatcherHost( | 1141 new ServiceWorkerDispatcherHost( |
1142 GetID(), message_port_message_filter_.get(), resource_context, | 1142 GetID(), message_port_message_filter_.get(), resource_context, |
1143 base::Bind(&RenderProcessHostImpl::CreateURLLoaderFactory, | 1143 CreateURLLoaderFactoryGetter()); |
1144 weak_factory_.GetWeakPtr())); | |
1145 service_worker_filter->Init( | 1144 service_worker_filter->Init( |
1146 storage_partition_impl_->GetServiceWorkerContext()); | 1145 storage_partition_impl_->GetServiceWorkerContext()); |
1147 AddFilter(service_worker_filter.get()); | 1146 AddFilter(service_worker_filter.get()); |
1148 | 1147 |
1149 AddFilter(new SharedWorkerMessageFilter( | 1148 AddFilter(new SharedWorkerMessageFilter( |
1150 GetID(), resource_context, | 1149 GetID(), resource_context, |
1151 WorkerStoragePartition( | 1150 WorkerStoragePartition( |
1152 storage_partition_impl_->GetURLRequestContext(), | 1151 storage_partition_impl_->GetURLRequestContext(), |
1153 storage_partition_impl_->GetMediaURLRequestContext(), | 1152 storage_partition_impl_->GetMediaURLRequestContext(), |
1154 storage_partition_impl_->GetAppCacheService(), | 1153 storage_partition_impl_->GetAppCacheService(), |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1402 } | 1401 } |
1403 | 1402 |
1404 void RenderProcessHostImpl::PurgeAndSuspend() { | 1403 void RenderProcessHostImpl::PurgeAndSuspend() { |
1405 Send(new ChildProcessMsg_PurgeAndSuspend()); | 1404 Send(new ChildProcessMsg_PurgeAndSuspend()); |
1406 } | 1405 } |
1407 | 1406 |
1408 mojom::Renderer* RenderProcessHostImpl::GetRendererInterface() { | 1407 mojom::Renderer* RenderProcessHostImpl::GetRendererInterface() { |
1409 return renderer_interface_.get(); | 1408 return renderer_interface_.get(); |
1410 } | 1409 } |
1411 | 1410 |
1411 MojoURLLoaderFactoryGetter | |
1412 RenderProcessHostImpl::CreateURLLoaderFactoryGetter() { | |
1413 return base::Bind(&RenderProcessHostImpl::CreateURLLoaderFactory, | |
1414 weak_factory_.GetWeakPtr()); | |
horo
2016/10/31 14:50:32
WeakPtr is not thread safe.
So we should not pass
piman
2016/10/31 20:43:25
I'll wait for the update before a full review. Jus
| |
1415 } | |
1416 | |
1412 mojom::RouteProvider* RenderProcessHostImpl::GetRemoteRouteProvider() { | 1417 mojom::RouteProvider* RenderProcessHostImpl::GetRemoteRouteProvider() { |
1413 return remote_route_provider_.get(); | 1418 return remote_route_provider_.get(); |
1414 } | 1419 } |
1415 | 1420 |
1416 void RenderProcessHostImpl::AddRoute(int32_t routing_id, | 1421 void RenderProcessHostImpl::AddRoute(int32_t routing_id, |
1417 IPC::Listener* listener) { | 1422 IPC::Listener* listener) { |
1418 CHECK(!listeners_.Lookup(routing_id)) << "Found Routing ID Conflict: " | 1423 CHECK(!listeners_.Lookup(routing_id)) << "Found Routing ID Conflict: " |
1419 << routing_id; | 1424 << routing_id; |
1420 listeners_.AddWithID(listener, routing_id); | 1425 listeners_.AddWithID(listener, routing_id); |
1421 } | 1426 } |
(...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2983 bad_message::ReceivedBadMessage(render_process_id, | 2988 bad_message::ReceivedBadMessage(render_process_id, |
2984 bad_message::RPH_MOJO_PROCESS_ERROR); | 2989 bad_message::RPH_MOJO_PROCESS_ERROR); |
2985 } | 2990 } |
2986 | 2991 |
2987 void RenderProcessHostImpl::CreateURLLoaderFactory( | 2992 void RenderProcessHostImpl::CreateURLLoaderFactory( |
2988 mojo::InterfaceRequest<mojom::URLLoaderFactory> request) { | 2993 mojo::InterfaceRequest<mojom::URLLoaderFactory> request) { |
2989 URLLoaderFactoryImpl::Create(resource_message_filter_, std::move(request)); | 2994 URLLoaderFactoryImpl::Create(resource_message_filter_, std::move(request)); |
2990 } | 2995 } |
2991 | 2996 |
2992 } // namespace content | 2997 } // namespace content |
OLD | NEW |