| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 #include "content/browser/renderer_host/media/video_capture_host.h" | 104 #include "content/browser/renderer_host/media/video_capture_host.h" |
| 105 #include "content/browser/renderer_host/offscreen_canvas_surface_impl.h" | 105 #include "content/browser/renderer_host/offscreen_canvas_surface_impl.h" |
| 106 #include "content/browser/renderer_host/pepper/pepper_message_filter.h" | 106 #include "content/browser/renderer_host/pepper/pepper_message_filter.h" |
| 107 #include "content/browser/renderer_host/pepper/pepper_renderer_connection.h" | 107 #include "content/browser/renderer_host/pepper/pepper_renderer_connection.h" |
| 108 #include "content/browser/renderer_host/render_message_filter.h" | 108 #include "content/browser/renderer_host/render_message_filter.h" |
| 109 #include "content/browser/renderer_host/render_view_host_delegate.h" | 109 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 110 #include "content/browser/renderer_host/render_view_host_impl.h" | 110 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 111 #include "content/browser/renderer_host/render_widget_helper.h" | 111 #include "content/browser/renderer_host/render_widget_helper.h" |
| 112 #include "content/browser/renderer_host/render_widget_host_impl.h" | 112 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 113 #include "content/browser/renderer_host/text_input_client_message_filter.h" | 113 #include "content/browser/renderer_host/text_input_client_message_filter.h" |
| 114 #include "content/browser/renderer_host/websocket_dispatcher_host.h" | |
| 115 #include "content/browser/resolve_proxy_msg_helper.h" | 114 #include "content/browser/resolve_proxy_msg_helper.h" |
| 116 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 115 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 117 #include "content/browser/service_worker/service_worker_dispatcher_host.h" | 116 #include "content/browser/service_worker/service_worker_dispatcher_host.h" |
| 118 #include "content/browser/shared_worker/shared_worker_message_filter.h" | 117 #include "content/browser/shared_worker/shared_worker_message_filter.h" |
| 119 #include "content/browser/shared_worker/worker_storage_partition.h" | 118 #include "content/browser/shared_worker/worker_storage_partition.h" |
| 120 #include "content/browser/speech/speech_recognition_dispatcher_host.h" | 119 #include "content/browser/speech/speech_recognition_dispatcher_host.h" |
| 121 #include "content/browser/storage_partition_impl.h" | 120 #include "content/browser/storage_partition_impl.h" |
| 122 #include "content/browser/streams/stream_context.h" | 121 #include "content/browser/streams/stream_context.h" |
| 123 #include "content/browser/tracing/trace_message_filter.h" | 122 #include "content/browser/tracing/trace_message_filter.h" |
| 123 #include "content/browser/websockets/websocket_manager.h" |
| 124 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 124 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
| 125 #include "content/common/child_process_host_impl.h" | 125 #include "content/common/child_process_host_impl.h" |
| 126 #include "content/common/child_process_messages.h" | 126 #include "content/common/child_process_messages.h" |
| 127 #include "content/common/content_switches_internal.h" | 127 #include "content/common/content_switches_internal.h" |
| 128 #include "content/common/frame_messages.h" | 128 #include "content/common/frame_messages.h" |
| 129 #include "content/common/gpu_host_messages.h" | 129 #include "content/common/gpu_host_messages.h" |
| 130 #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" | 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" |
| (...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 // should eventually be if (!ShouldUseDirectWrite()) guarded. | 1028 // should eventually be if (!ShouldUseDirectWrite()) guarded. |
| 1029 channel_->AddFilter(new FontCacheDispatcher()); | 1029 channel_->AddFilter(new FontCacheDispatcher()); |
| 1030 #elif defined(OS_ANDROID) | 1030 #elif defined(OS_ANDROID) |
| 1031 browser_demuxer_android_ = new BrowserDemuxerAndroid(); | 1031 browser_demuxer_android_ = new BrowserDemuxerAndroid(); |
| 1032 AddFilter(browser_demuxer_android_.get()); | 1032 AddFilter(browser_demuxer_android_.get()); |
| 1033 #endif | 1033 #endif |
| 1034 #if defined(ENABLE_BROWSER_CDMS) | 1034 #if defined(ENABLE_BROWSER_CDMS) |
| 1035 AddFilter(new BrowserCdmManager(GetID(), NULL)); | 1035 AddFilter(new BrowserCdmManager(GetID(), NULL)); |
| 1036 #endif | 1036 #endif |
| 1037 | 1037 |
| 1038 WebSocketDispatcherHost::GetRequestContextCallback | |
| 1039 websocket_request_context_callback( | |
| 1040 base::Bind(&GetRequestContext, request_context, media_request_context, | |
| 1041 RESOURCE_TYPE_SUB_RESOURCE)); | |
| 1042 | |
| 1043 AddFilter(new WebSocketDispatcherHost( | |
| 1044 GetID(), websocket_request_context_callback, blob_storage_context.get(), | |
| 1045 storage_partition_impl_)); | |
| 1046 | |
| 1047 message_port_message_filter_ = new MessagePortMessageFilter( | 1038 message_port_message_filter_ = new MessagePortMessageFilter( |
| 1048 base::Bind(&RenderWidgetHelper::GetNextRoutingID, | 1039 base::Bind(&RenderWidgetHelper::GetNextRoutingID, |
| 1049 base::Unretained(widget_helper_.get()))); | 1040 base::Unretained(widget_helper_.get()))); |
| 1050 AddFilter(message_port_message_filter_.get()); | 1041 AddFilter(message_port_message_filter_.get()); |
| 1051 | 1042 |
| 1052 scoped_refptr<CacheStorageDispatcherHost> cache_storage_filter = | 1043 scoped_refptr<CacheStorageDispatcherHost> cache_storage_filter = |
| 1053 new CacheStorageDispatcherHost(); | 1044 new CacheStorageDispatcherHost(); |
| 1054 cache_storage_filter->Init(storage_partition_impl_->GetCacheStorageContext()); | 1045 cache_storage_filter->Init(storage_partition_impl_->GetCacheStorageContext()); |
| 1055 AddFilter(cache_storage_filter.get()); | 1046 AddFilter(cache_storage_filter.get()); |
| 1056 | 1047 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1163 registry->AddInterface(base::Bind(&hyphenation::HyphenationImpl::Create), | 1154 registry->AddInterface(base::Bind(&hyphenation::HyphenationImpl::Create), |
| 1164 file_task_runner); | 1155 file_task_runner); |
| 1165 #endif | 1156 #endif |
| 1166 | 1157 |
| 1167 // These callbacks will be run immediately on the IO thread. | 1158 // These callbacks will be run immediately on the IO thread. |
| 1168 registry->AddInterface(base::Bind(&DeviceLightHost::Create)); | 1159 registry->AddInterface(base::Bind(&DeviceLightHost::Create)); |
| 1169 registry->AddInterface(base::Bind(&DeviceMotionHost::Create)); | 1160 registry->AddInterface(base::Bind(&DeviceMotionHost::Create)); |
| 1170 registry->AddInterface(base::Bind(&DeviceOrientationHost::Create)); | 1161 registry->AddInterface(base::Bind(&DeviceOrientationHost::Create)); |
| 1171 registry->AddInterface(base::Bind(&DeviceOrientationAbsoluteHost::Create)); | 1162 registry->AddInterface(base::Bind(&DeviceOrientationAbsoluteHost::Create)); |
| 1172 | 1163 |
| 1164 // This is to support usage of WebSockets in cases in which there is no |
| 1165 // associated RenderFrame (e.g., Shared Workers). |
| 1166 registry->AddInterface( |
| 1167 base::Bind(&WebSocketManager::CreateWebSocket, GetID(), MSG_ROUTING_NONE), |
| 1168 ui_task_runner); |
| 1169 |
| 1173 GetContentClient()->browser()->ExposeInterfacesToRenderer(registry.get(), | 1170 GetContentClient()->browser()->ExposeInterfacesToRenderer(registry.get(), |
| 1174 this); | 1171 this); |
| 1175 | 1172 |
| 1176 MojoShellConnection* mojo_shell_connection = | 1173 MojoShellConnection* mojo_shell_connection = |
| 1177 BrowserContext::GetMojoShellConnectionFor(browser_context_); | 1174 BrowserContext::GetMojoShellConnectionFor(browser_context_); |
| 1178 std::unique_ptr<ConnectionFilterImpl> connection_filter( | 1175 std::unique_ptr<ConnectionFilterImpl> connection_filter( |
| 1179 new ConnectionFilterImpl(mojo_child_connection_->child_identity(), | 1176 new ConnectionFilterImpl(mojo_child_connection_->child_identity(), |
| 1180 std::move(registry))); | 1177 std::move(registry))); |
| 1181 connection_filter_ = connection_filter.get(); | 1178 connection_filter_ = connection_filter.get(); |
| 1182 mojo_shell_connection->AddConnectionFilter(std::move(connection_filter)); | 1179 mojo_shell_connection->AddConnectionFilter(std::move(connection_filter)); |
| (...skipping 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2830 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 2827 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
| 2831 | 2828 |
| 2832 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 2829 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
| 2833 // enough information here so that we can determine what the bad message was. | 2830 // enough information here so that we can determine what the bad message was. |
| 2834 base::debug::Alias(&error); | 2831 base::debug::Alias(&error); |
| 2835 bad_message::ReceivedBadMessage(process.get(), | 2832 bad_message::ReceivedBadMessage(process.get(), |
| 2836 bad_message::RPH_MOJO_PROCESS_ERROR); | 2833 bad_message::RPH_MOJO_PROCESS_ERROR); |
| 2837 } | 2834 } |
| 2838 | 2835 |
| 2839 } // namespace content | 2836 } // namespace content |
| OLD | NEW |