Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 2183703005: Renderers should obtain browser InterfaceProvider by connecting to browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
78 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h" 78 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h"
79 #include "content/browser/loader/resource_message_filter.h" 79 #include "content/browser/loader/resource_message_filter.h"
80 #include "content/browser/loader/resource_scheduler_filter.h" 80 #include "content/browser/loader/resource_scheduler_filter.h"
81 #include "content/browser/media/capture/audio_mirroring_manager.h" 81 #include "content/browser/media/capture/audio_mirroring_manager.h"
82 #include "content/browser/media/capture/image_capture_impl.h" 82 #include "content/browser/media/capture/image_capture_impl.h"
83 #include "content/browser/media/media_internals.h" 83 #include "content/browser/media/media_internals.h"
84 #include "content/browser/media/midi_host.h" 84 #include "content/browser/media/midi_host.h"
85 #include "content/browser/memory/memory_message_filter.h" 85 #include "content/browser/memory/memory_message_filter.h"
86 #include "content/browser/message_port_message_filter.h" 86 #include "content/browser/message_port_message_filter.h"
87 #include "content/browser/mime_registry_impl.h" 87 #include "content/browser/mime_registry_impl.h"
88 #include "content/browser/mojo/constants.h"
89 #include "content/browser/mojo/mojo_child_connection.h" 88 #include "content/browser/mojo/mojo_child_connection.h"
90 #include "content/browser/notifications/notification_message_filter.h" 89 #include "content/browser/notifications/notification_message_filter.h"
91 #include "content/browser/notifications/platform_notification_context_impl.h" 90 #include "content/browser/notifications/platform_notification_context_impl.h"
92 #include "content/browser/permissions/permission_service_context.h" 91 #include "content/browser/permissions/permission_service_context.h"
93 #include "content/browser/permissions/permission_service_impl.h" 92 #include "content/browser/permissions/permission_service_impl.h"
94 #include "content/browser/profiler_message_filter.h" 93 #include "content/browser/profiler_message_filter.h"
95 #include "content/browser/push_messaging/push_messaging_message_filter.h" 94 #include "content/browser/push_messaging/push_messaging_message_filter.h"
96 #include "content/browser/quota_dispatcher_host.h" 95 #include "content/browser/quota_dispatcher_host.h"
97 #include "content/browser/renderer_host/clipboard_message_filter.h" 96 #include "content/browser/renderer_host/clipboard_message_filter.h"
98 #include "content/browser/renderer_host/database_message_filter.h" 97 #include "content/browser/renderer_host/database_message_filter.h"
(...skipping 23 matching lines...) Expand all
122 #include "content/browser/storage_partition_impl.h" 121 #include "content/browser/storage_partition_impl.h"
123 #include "content/browser/streams/stream_context.h" 122 #include "content/browser/streams/stream_context.h"
124 #include "content/browser/tracing/trace_message_filter.h" 123 #include "content/browser/tracing/trace_message_filter.h"
125 #include "content/browser/webui/web_ui_controller_factory_registry.h" 124 #include "content/browser/webui/web_ui_controller_factory_registry.h"
126 #include "content/common/child_process_host_impl.h" 125 #include "content/common/child_process_host_impl.h"
127 #include "content/common/child_process_messages.h" 126 #include "content/common/child_process_messages.h"
128 #include "content/common/content_switches_internal.h" 127 #include "content/common/content_switches_internal.h"
129 #include "content/common/frame_messages.h" 128 #include "content/common/frame_messages.h"
130 #include "content/common/gpu_host_messages.h" 129 #include "content/common/gpu_host_messages.h"
131 #include "content/common/in_process_child_thread_params.h" 130 #include "content/common/in_process_child_thread_params.h"
131 #include "content/common/mojo/constants.h"
132 #include "content/common/mojo/mojo_shell_connection_impl.h" 132 #include "content/common/mojo/mojo_shell_connection_impl.h"
133 #include "content/common/render_process_messages.h" 133 #include "content/common/render_process_messages.h"
134 #include "content/common/resource_messages.h" 134 #include "content/common/resource_messages.h"
135 #include "content/common/site_isolation_policy.h" 135 #include "content/common/site_isolation_policy.h"
136 #include "content/common/view_messages.h" 136 #include "content/common/view_messages.h"
137 #include "content/public/browser/browser_context.h" 137 #include "content/public/browser/browser_context.h"
138 #include "content/public/browser/browser_thread.h" 138 #include "content/public/browser/browser_thread.h"
139 #include "content/public/browser/content_browser_client.h" 139 #include "content/public/browser/content_browser_client.h"
140 #include "content/public/browser/notification_service.h" 140 #include "content/public/browser/notification_service.h"
141 #include "content/public/browser/notification_types.h" 141 #include "content/public/browser/notification_types.h"
142 #include "content/public/browser/render_process_host_factory.h" 142 #include "content/public/browser/render_process_host_factory.h"
143 #include "content/public/browser/render_process_host_observer.h" 143 #include "content/public/browser/render_process_host_observer.h"
144 #include "content/public/browser/render_widget_host.h" 144 #include "content/public/browser/render_widget_host.h"
145 #include "content/public/browser/render_widget_host_iterator.h" 145 #include "content/public/browser/render_widget_host_iterator.h"
146 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" 146 #include "content/public/browser/render_widget_host_view_frame_subscriber.h"
147 #include "content/public/browser/resource_context.h" 147 #include "content/public/browser/resource_context.h"
148 #include "content/public/browser/user_metrics.h" 148 #include "content/public/browser/user_metrics.h"
149 #include "content/public/browser/worker_service.h" 149 #include "content/public/browser/worker_service.h"
150 #include "content/public/common/child_process_host.h" 150 #include "content/public/common/child_process_host.h"
151 #include "content/public/common/connection_filter.h"
151 #include "content/public/common/content_constants.h" 152 #include "content/public/common/content_constants.h"
152 #include "content/public/common/content_features.h" 153 #include "content/public/common/content_features.h"
153 #include "content/public/common/content_switches.h" 154 #include "content/public/common/content_switches.h"
154 #include "content/public/common/mojo_channel_switches.h" 155 #include "content/public/common/mojo_channel_switches.h"
155 #include "content/public/common/process_type.h" 156 #include "content/public/common/process_type.h"
156 #include "content/public/common/resource_type.h" 157 #include "content/public/common/resource_type.h"
157 #include "content/public/common/result_codes.h" 158 #include "content/public/common/result_codes.h"
158 #include "content/public/common/sandboxed_process_launcher_delegate.h" 159 #include "content/public/common/sandboxed_process_launcher_delegate.h"
159 #include "content/public/common/url_constants.h" 160 #include "content/public/common/url_constants.h"
160 #include "device/battery/battery_monitor_impl.h" 161 #include "device/battery/battery_monitor_impl.h"
161 #include "gpu/GLES2/gl2extchromium.h" 162 #include "gpu/GLES2/gl2extchromium.h"
162 #include "gpu/command_buffer/client/gpu_switches.h" 163 #include "gpu/command_buffer/client/gpu_switches.h"
163 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 164 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
164 #include "gpu/command_buffer/service/gpu_switches.h" 165 #include "gpu/command_buffer/service/gpu_switches.h"
165 #include "ipc/attachment_broker.h" 166 #include "ipc/attachment_broker.h"
166 #include "ipc/attachment_broker_privileged.h" 167 #include "ipc/attachment_broker_privileged.h"
167 #include "ipc/ipc_channel.h" 168 #include "ipc/ipc_channel.h"
168 #include "ipc/ipc_channel_mojo.h" 169 #include "ipc/ipc_channel_mojo.h"
169 #include "ipc/ipc_logging.h" 170 #include "ipc/ipc_logging.h"
170 #include "ipc/ipc_switches.h" 171 #include "ipc/ipc_switches.h"
171 #include "media/base/media_switches.h" 172 #include "media/base/media_switches.h"
172 #include "mojo/edk/embedder/embedder.h" 173 #include "mojo/edk/embedder/embedder.h"
173 #include "net/url_request/url_request_context_getter.h" 174 #include "net/url_request/url_request_context_getter.h"
174 #include "ppapi/shared_impl/ppapi_switches.h" 175 #include "ppapi/shared_impl/ppapi_switches.h"
176 #include "services/shell/public/cpp/connection.h"
175 #include "services/shell/public/cpp/interface_provider.h" 177 #include "services/shell/public/cpp/interface_provider.h"
176 #include "services/shell/public/cpp/interface_registry.h" 178 #include "services/shell/public/cpp/interface_registry.h"
177 #include "services/shell/runner/common/switches.h" 179 #include "services/shell/runner/common/switches.h"
178 #include "storage/browser/fileapi/sandbox_file_system_backend.h" 180 #include "storage/browser/fileapi/sandbox_file_system_backend.h"
179 #include "third_party/skia/include/core/SkBitmap.h" 181 #include "third_party/skia/include/core/SkBitmap.h"
180 #include "ui/base/ui_base_switches.h" 182 #include "ui/base/ui_base_switches.h"
181 #include "ui/display/display_switches.h" 183 #include "ui/display/display_switches.h"
182 #include "ui/events/event_switches.h" 184 #include "ui/events/event_switches.h"
183 #include "ui/gfx/switches.h" 185 #include "ui/gfx/switches.h"
184 #include "ui/gl/gl_switches.h" 186 #include "ui/gl/gl_switches.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 BrowserMainLoop::GetInstance()->memory_coordinator()->CreateHandle( 448 BrowserMainLoop::GetInstance()->memory_coordinator()->CreateHandle(
447 render_process_id, std::move(request)); 449 render_process_id, std::move(request));
448 } 450 }
449 451
450 } // namespace 452 } // namespace
451 453
452 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL; 454 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL;
453 455
454 base::MessageLoop* g_in_process_thread; 456 base::MessageLoop* g_in_process_thread;
455 457
458 // Stores the maximum number of renderer processes the content module can
459 // create.
460 static size_t g_max_renderer_count_override = 0;
461
462 // static
463 bool g_run_renderer_in_process_ = false;
464
465 // Held by the RPH's BrowserContext's MojoShellConnection, ownership transferred
466 // back to RPH upon RPH destruction.
467 class RenderProcessHostImpl::ConnectionFilterImpl : public ConnectionFilter {
468 public:
469 ConnectionFilterImpl(
470 const shell::Identity& child_identity,
471 std::unique_ptr<shell::InterfaceRegistry> registry)
472 : child_identity_(child_identity),
473 registry_(std::move(registry)) {}
474 ~ConnectionFilterImpl() override {
475 scoped_refptr<base::SequencedTaskRunner> io_task_runner =
476 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
477 io_task_runner->DeleteSoon(FROM_HERE, weak_factory_.release());
478 }
479
480 private:
481 // ConnectionFilter:
482 bool OnConnect(shell::Connection* connection,
483 shell::Connector* connector) override {
484 if (!weak_factory_)
485 weak_factory_.reset(new base::WeakPtrFactory<ConnectionFilterImpl>(this));
486
487 // We only fulfill connections from the renderer we host.
488 const shell::Identity& remote_identity = connection->GetRemoteIdentity();
489 if (child_identity_.name() != remote_identity.name() ||
490 child_identity_.instance() != remote_identity.instance()) {
491 return false;
492 }
493
494 std::set<std::string> interface_names;
495 registry_->GetInterfaceNames(&interface_names);
496 for (auto& interface_name : interface_names) {
497 // Note that the added callbacks may outlive this object, which is
498 // destroyed in RPH::Cleanup().
499 connection->GetInterfaceRegistry()->AddInterface(
500 interface_name,
501 base::Bind(&ConnectionFilterImpl::GetInterface,
502 weak_factory_->GetWeakPtr(),
503 interface_name));
504 }
505 return true;
506 }
507
508 void GetInterface(const std::string& interface_name,
509 mojo::ScopedMessagePipeHandle handle) {
510 shell::mojom::InterfaceProvider* provider = registry_.get();
511 provider->GetInterface(interface_name, std::move(handle));
512 }
513
514 shell::Identity child_identity_;
515 std::unique_ptr<shell::InterfaceRegistry> registry_;
516 std::unique_ptr<base::WeakPtrFactory<ConnectionFilterImpl>> weak_factory_;
517
518 DISALLOW_COPY_AND_ASSIGN(ConnectionFilterImpl);
519 };
520
456 base::MessageLoop* 521 base::MessageLoop*
457 RenderProcessHostImpl::GetInProcessRendererThreadForTesting() { 522 RenderProcessHostImpl::GetInProcessRendererThreadForTesting() {
458 return g_in_process_thread; 523 return g_in_process_thread;
459 } 524 }
460 525
461 // Stores the maximum number of renderer processes the content module can
462 // create.
463 static size_t g_max_renderer_count_override = 0;
464
465 // static 526 // static
466 size_t RenderProcessHost::GetMaxRendererProcessCount() { 527 size_t RenderProcessHost::GetMaxRendererProcessCount() {
467 if (g_max_renderer_count_override) 528 if (g_max_renderer_count_override)
468 return g_max_renderer_count_override; 529 return g_max_renderer_count_override;
469 530
470 #if defined(OS_ANDROID) 531 #if defined(OS_ANDROID)
471 // On Android we don't maintain a limit of renderer process hosts - we are 532 // On Android we don't maintain a limit of renderer process hosts - we are
472 // happy with keeping a lot of these, as long as the number of live renderer 533 // happy with keeping a lot of these, as long as the number of live renderer
473 // processes remains reasonable, and on Android the OS takes care of that. 534 // processes remains reasonable, and on Android the OS takes care of that.
474 return std::numeric_limits<size_t>::max(); 535 return std::numeric_limits<size_t>::max();
(...skipping 27 matching lines...) Expand all
502 max_count /= kEstimatedWebContentsMemoryUsage; 563 max_count /= kEstimatedWebContentsMemoryUsage;
503 564
504 const size_t kMinRendererProcessCount = 3; 565 const size_t kMinRendererProcessCount = 3;
505 max_count = std::max(max_count, kMinRendererProcessCount); 566 max_count = std::max(max_count, kMinRendererProcessCount);
506 max_count = std::min(max_count, kMaxRendererProcessCount); 567 max_count = std::min(max_count, kMaxRendererProcessCount);
507 } 568 }
508 return max_count; 569 return max_count;
509 } 570 }
510 571
511 // static 572 // static
512 bool g_run_renderer_in_process_ = false;
513
514 // static
515 void RenderProcessHost::SetMaxRendererProcessCount(size_t count) { 573 void RenderProcessHost::SetMaxRendererProcessCount(size_t count) {
516 g_max_renderer_count_override = count; 574 g_max_renderer_count_override = count;
517 } 575 }
518 576
519 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) 577 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
520 // static 578 // static
521 void RenderProcessHostImpl::EarlyZygoteLaunch() { 579 void RenderProcessHostImpl::EarlyZygoteLaunch() {
522 DCHECK(!g_render_zygote); 580 DCHECK(!g_render_zygote);
523 // TODO(kerrnel): Investigate doing this without the ZygoteHostImpl as a 581 // TODO(kerrnel): Investigate doing this without the ZygoteHostImpl as a
524 // proxy. It is currently done this way due to concerns about race 582 // proxy. It is currently done this way due to concerns about race
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 AddFilter(new HistogramMessageFilter()); 1099 AddFilter(new HistogramMessageFilter());
1042 AddFilter(new MemoryMessageFilter(this)); 1100 AddFilter(new MemoryMessageFilter(this));
1043 AddFilter(new PushMessagingMessageFilter( 1101 AddFilter(new PushMessagingMessageFilter(
1044 GetID(), storage_partition_impl_->GetServiceWorkerContext())); 1102 GetID(), storage_partition_impl_->GetServiceWorkerContext()));
1045 #if defined(OS_ANDROID) 1103 #if defined(OS_ANDROID)
1046 AddFilter(new ScreenOrientationMessageFilterAndroid()); 1104 AddFilter(new ScreenOrientationMessageFilterAndroid());
1047 #endif 1105 #endif
1048 } 1106 }
1049 1107
1050 void RenderProcessHostImpl::RegisterMojoInterfaces() { 1108 void RenderProcessHostImpl::RegisterMojoInterfaces() {
1051 #if !defined(OS_ANDROID) 1109 std::unique_ptr<shell::InterfaceRegistry> registry(
1052 GetInterfaceRegistry()->AddInterface( 1110 new shell::InterfaceRegistry(nullptr));
1053 base::Bind(&device::BatteryMonitorImpl::Create)); 1111 #if defined(OS_ANDROID)
1112 interface_registry_android_ =
1113 InterfaceRegistryAndroid::Create(registry.get());
1114 InterfaceRegistrarAndroid::ExposeInterfacesToRenderer(
1115 interface_registry_android_.get());
1054 #endif 1116 #endif
1055 1117
1056 GetInterfaceRegistry()->AddInterface( 1118 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner =
1119 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI);
1120 #if !defined(OS_ANDROID)
1121 registry->AddInterface(base::Bind(&device::BatteryMonitorImpl::Create),
1122 ui_task_runner);
1123 #endif
1124 registry->AddInterface(
1057 base::Bind(&PermissionServiceContext::CreateService, 1125 base::Bind(&PermissionServiceContext::CreateService,
1058 base::Unretained(permission_service_context_.get()))); 1126 base::Unretained(permission_service_context_.get())),
1059 1127 ui_task_runner);
1060 // TODO(mcasas): finalize arguments. 1128 // TODO(mcasas): finalize arguments.
1061 GetInterfaceRegistry()->AddInterface( 1129 registry->AddInterface(base::Bind(&ImageCaptureImpl::Create),
1062 base::Bind(&ImageCaptureImpl::Create)); 1130 ui_task_runner);
1063 1131 registry->AddInterface(base::Bind(&OffscreenCanvasSurfaceImpl::Create),
1064 GetInterfaceRegistry()->AddInterface( 1132 ui_task_runner);
1065 base::Bind(&OffscreenCanvasSurfaceImpl::Create)); 1133 registry->AddInterface(
1066 1134 base::Bind(&BackgroundSyncContext::CreateService,
1067 GetInterfaceRegistry()->AddInterface(base::Bind( 1135 base::Unretained(
1068 &BackgroundSyncContext::CreateService, 1136 storage_partition_impl_->GetBackgroundSyncContext())),
1069 base::Unretained(storage_partition_impl_->GetBackgroundSyncContext()))); 1137 ui_task_runner);
1070 1138 registry->AddInterface(
1071 GetInterfaceRegistry()->AddInterface(base::Bind( 1139 base::Bind(&PlatformNotificationContextImpl::CreateService,
1072 &PlatformNotificationContextImpl::CreateService, 1140 base::Unretained(
1073 base::Unretained( 1141 storage_partition_impl_->GetPlatformNotificationContext()),
1074 storage_partition_impl_->GetPlatformNotificationContext()), GetID())); 1142 GetID()),
1075 1143 ui_task_runner);
1076 GetInterfaceRegistry()->AddInterface( 1144 registry->AddInterface(
1077 base::Bind(&RenderProcessHostImpl::CreateStoragePartitionService, 1145 base::Bind(&RenderProcessHostImpl::CreateStoragePartitionService,
1078 base::Unretained(this))); 1146 base::Unretained(this)),
1079 1147 ui_task_runner);
1080 GetInterfaceRegistry()->AddInterface( 1148 registry->AddInterface(
1081 base::Bind(&BroadcastChannelProvider::Connect, 1149 base::Bind(&BroadcastChannelProvider::Connect,
1082 base::Unretained( 1150 base::Unretained(
1083 storage_partition_impl_->GetBroadcastChannelProvider()))); 1151 storage_partition_impl_->GetBroadcastChannelProvider())),
1152 ui_task_runner);
1153 if (memory_coordinator::IsEnabled()) {
1154 registry->AddInterface(base::Bind(&CreateMemoryCoordinatorHandle, GetID()),
1155 ui_task_runner);
1156 }
1084 1157
1085 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner = 1158 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner =
1086 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE); 1159 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE);
1087 GetInterfaceRegistry()->AddInterface( 1160 registry->AddInterface(base::Bind(&MimeRegistryImpl::Create),
1088 base::Bind(&MimeRegistryImpl::Create), file_task_runner); 1161 file_task_runner);
1089
1090 #if defined(USE_MINIKIN_HYPHENATION) 1162 #if defined(USE_MINIKIN_HYPHENATION)
1091 GetInterfaceRegistry()->AddInterface( 1163 registry->AddInterface(base::Bind(&hyphenation::HyphenationImpl::Create),
1092 base::Bind(&hyphenation::HyphenationImpl::Create), file_task_runner); 1164 file_task_runner);
1093 #endif 1165 #endif
1094 1166
1095 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = 1167 // These callbacks will be run immediately on the IO thread.
1096 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); 1168 registry->AddInterface(base::Bind(&DeviceLightHost::Create));
1097 GetInterfaceRegistry()->AddInterface(base::Bind(&DeviceLightHost::Create), 1169 registry->AddInterface(base::Bind(&DeviceMotionHost::Create));
1098 io_task_runner); 1170 registry->AddInterface(base::Bind(&DeviceOrientationHost::Create));
1099 GetInterfaceRegistry()->AddInterface(base::Bind(&DeviceMotionHost::Create), 1171 registry->AddInterface(base::Bind(&DeviceOrientationAbsoluteHost::Create));
1100 io_task_runner);
1101 GetInterfaceRegistry()->AddInterface(
1102 base::Bind(&DeviceOrientationHost::Create), io_task_runner);
1103 GetInterfaceRegistry()->AddInterface(
1104 base::Bind(&DeviceOrientationAbsoluteHost::Create), io_task_runner);
1105 1172
1106 if (memory_coordinator::IsEnabled()) { 1173 GetContentClient()->browser()->ExposeInterfacesToRenderer(registry.get(),
1107 GetInterfaceRegistry()->AddInterface( 1174 this);
1108 base::Bind(&CreateMemoryCoordinatorHandle, GetID()));
1109 }
1110 1175
1111 #if defined(OS_ANDROID) 1176 MojoShellConnection* mojo_shell_connection =
1112 InterfaceRegistrarAndroid::ExposeInterfacesToRenderer( 1177 BrowserContext::GetMojoShellConnectionFor(browser_context_);
1113 mojo_child_connection_->interface_registry_android()); 1178 std::unique_ptr<ConnectionFilterImpl> connection_filter(
1114 #endif 1179 new ConnectionFilterImpl(mojo_child_connection_->child_identity(),
1115 1180 std::move(registry)));
1116 GetContentClient()->browser()->ExposeInterfacesToRenderer( 1181 connection_filter_ = connection_filter.get();
1117 GetInterfaceRegistry(), this); 1182 mojo_shell_connection->AddConnectionFilter(std::move(connection_filter));
1118 } 1183 }
1119 1184
1120 void RenderProcessHostImpl::CreateStoragePartitionService( 1185 void RenderProcessHostImpl::CreateStoragePartitionService(
1121 mojo::InterfaceRequest<mojom::StoragePartitionService> request) { 1186 mojo::InterfaceRequest<mojom::StoragePartitionService> request) {
1122 // DO NOT REMOVE THIS COMMAND LINE CHECK WITHOUT SECURITY REVIEW! 1187 // DO NOT REMOVE THIS COMMAND LINE CHECK WITHOUT SECURITY REVIEW!
1123 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1188 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1124 switches::kMojoLocalStorage)) { 1189 switches::kMojoLocalStorage)) {
1125 storage_partition_impl_->Bind(std::move(request)); 1190 storage_partition_impl_->Bind(std::move(request));
1126 } 1191 }
1127 } 1192 }
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
1915 RenderProcessHostObserver, observers_, 1980 RenderProcessHostObserver, observers_,
1916 RenderProcessExited(this, base::TERMINATION_STATUS_NORMAL_TERMINATION, 1981 RenderProcessExited(this, base::TERMINATION_STATUS_NORMAL_TERMINATION,
1917 0)); 1982 0));
1918 } 1983 }
1919 FOR_EACH_OBSERVER(RenderProcessHostObserver, observers_, 1984 FOR_EACH_OBSERVER(RenderProcessHostObserver, observers_,
1920 RenderProcessHostDestroyed(this)); 1985 RenderProcessHostDestroyed(this));
1921 NotificationService::current()->Notify( 1986 NotificationService::current()->Notify(
1922 NOTIFICATION_RENDERER_PROCESS_TERMINATED, 1987 NOTIFICATION_RENDERER_PROCESS_TERMINATED,
1923 Source<RenderProcessHost>(this), NotificationService::NoDetails()); 1988 Source<RenderProcessHost>(this), NotificationService::NoDetails());
1924 1989
1990 if (connection_filter_) {
1991 MojoShellConnection* mojo_shell_connection =
1992 BrowserContext::GetMojoShellConnectionFor(browser_context_);
1993 // Throw the result away, so the connection filter is deleted.
1994 mojo_shell_connection->RemoveConnectionFilter(connection_filter_);
1995 }
1996
1925 #ifndef NDEBUG 1997 #ifndef NDEBUG
1926 is_self_deleted_ = true; 1998 is_self_deleted_ = true;
1927 #endif 1999 #endif
1928 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); 2000 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
1929 deleting_soon_ = true; 2001 deleting_soon_ = true;
1930 2002
1931 #if USE_ATTACHMENT_BROKER 2003 #if USE_ATTACHMENT_BROKER
1932 IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel( 2004 IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel(
1933 channel_.get()); 2005 channel_.get());
1934 #endif 2006 #endif
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
2764 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 2836 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
2765 2837
2766 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias 2838 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias
2767 // enough information here so that we can determine what the bad message was. 2839 // enough information here so that we can determine what the bad message was.
2768 base::debug::Alias(&error); 2840 base::debug::Alias(&error);
2769 bad_message::ReceivedBadMessage(process.get(), 2841 bad_message::ReceivedBadMessage(process.get(),
2770 bad_message::RPH_MOJO_PROCESS_ERROR); 2842 bad_message::RPH_MOJO_PROCESS_ERROR);
2771 } 2843 }
2772 2844
2773 } // namespace content 2845 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.h ('k') | content/browser/utility_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698