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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 #include "content/browser/renderer_host/file_utilities_message_filter.h" | 106 #include "content/browser/renderer_host/file_utilities_message_filter.h" |
107 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" | 107 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" |
108 #include "content/browser/renderer_host/media/audio_renderer_host.h" | 108 #include "content/browser/renderer_host/media/audio_renderer_host.h" |
109 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h" | 109 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h" |
110 #include "content/browser/renderer_host/media/peer_connection_tracker_host.h" | 110 #include "content/browser/renderer_host/media/peer_connection_tracker_host.h" |
111 #include "content/browser/renderer_host/media/video_capture_host.h" | 111 #include "content/browser/renderer_host/media/video_capture_host.h" |
112 #include "content/browser/renderer_host/offscreen_canvas_provider_impl.h" | 112 #include "content/browser/renderer_host/offscreen_canvas_provider_impl.h" |
113 #include "content/browser/renderer_host/pepper/pepper_message_filter.h" | 113 #include "content/browser/renderer_host/pepper/pepper_message_filter.h" |
114 #include "content/browser/renderer_host/pepper/pepper_renderer_connection.h" | 114 #include "content/browser/renderer_host/pepper/pepper_renderer_connection.h" |
115 #include "content/browser/renderer_host/render_message_filter.h" | 115 #include "content/browser/renderer_host/render_message_filter.h" |
| 116 #include "content/browser/renderer_host/render_message_filter_ui.h" |
116 #include "content/browser/renderer_host/render_view_host_delegate.h" | 117 #include "content/browser/renderer_host/render_view_host_delegate.h" |
117 #include "content/browser/renderer_host/render_view_host_impl.h" | 118 #include "content/browser/renderer_host/render_view_host_impl.h" |
118 #include "content/browser/renderer_host/render_widget_helper.h" | 119 #include "content/browser/renderer_host/render_widget_helper.h" |
119 #include "content/browser/renderer_host/render_widget_host_impl.h" | 120 #include "content/browser/renderer_host/render_widget_host_impl.h" |
120 #include "content/browser/renderer_host/render_widget_host_view_frame_subscriber
.h" | 121 #include "content/browser/renderer_host/render_widget_host_view_frame_subscriber
.h" |
121 #include "content/browser/renderer_host/text_input_client_message_filter.h" | 122 #include "content/browser/renderer_host/text_input_client_message_filter.h" |
122 #include "content/browser/resolve_proxy_msg_helper.h" | 123 #include "content/browser/resolve_proxy_msg_helper.h" |
123 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 124 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
124 #include "content/browser/service_worker/service_worker_dispatcher_host.h" | 125 #include "content/browser/service_worker/service_worker_dispatcher_host.h" |
125 #include "content/browser/shared_worker/shared_worker_message_filter.h" | 126 #include "content/browser/shared_worker/shared_worker_message_filter.h" |
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 AddFilter(new MemoryMessageFilter(this)); | 1184 AddFilter(new MemoryMessageFilter(this)); |
1184 #if defined(OS_ANDROID) | 1185 #if defined(OS_ANDROID) |
1185 synchronous_compositor_filter_ = | 1186 synchronous_compositor_filter_ = |
1186 new SynchronousCompositorBrowserFilter(GetID()); | 1187 new SynchronousCompositorBrowserFilter(GetID()); |
1187 AddFilter(synchronous_compositor_filter_.get()); | 1188 AddFilter(synchronous_compositor_filter_.get()); |
1188 #endif | 1189 #endif |
1189 } | 1190 } |
1190 | 1191 |
1191 void RenderProcessHostImpl::RegisterMojoInterfaces() { | 1192 void RenderProcessHostImpl::RegisterMojoInterfaces() { |
1192 auto registry = base::MakeUnique<service_manager::BinderRegistry>(); | 1193 auto registry = base::MakeUnique<service_manager::BinderRegistry>(); |
| 1194 associated_registry_.reset(new AssociatedInterfaceRegistryImpl()); |
1193 | 1195 |
1194 channel_->AddAssociatedInterfaceForIOThread( | 1196 channel_->AddAssociatedInterfaceForIOThread( |
1195 base::Bind(&IndexedDBDispatcherHost::AddBinding, | 1197 base::Bind(&IndexedDBDispatcherHost::AddBinding, |
1196 base::Unretained(indexed_db_factory_.get()))); | 1198 base::Unretained(indexed_db_factory_.get()))); |
1197 | 1199 |
| 1200 static_cast<AssociatedInterfaceRegistry*>(associated_registry_.get()) |
| 1201 ->AddInterface(base::Bind( |
| 1202 &RenderMessageFilterUI::CreateFilter, base::Unretained(this), |
| 1203 base::RetainedRef(storage_partition_impl_->GetDOMStorageContext()))); |
| 1204 |
1198 #if defined(OS_ANDROID) | 1205 #if defined(OS_ANDROID) |
1199 AddUIThreadInterface( | 1206 AddUIThreadInterface( |
1200 registry.get(), GetGlobalJavaInterfaces() | 1207 registry.get(), GetGlobalJavaInterfaces() |
1201 ->CreateInterfaceFactory< | 1208 ->CreateInterfaceFactory< |
1202 shape_detection::mojom::FaceDetectionProvider>()); | 1209 shape_detection::mojom::FaceDetectionProvider>()); |
1203 AddUIThreadInterface( | 1210 AddUIThreadInterface( |
1204 registry.get(), | 1211 registry.get(), |
1205 GetGlobalJavaInterfaces() | 1212 GetGlobalJavaInterfaces() |
1206 ->CreateInterfaceFactory<shape_detection::mojom::BarcodeDetection>()); | 1213 ->CreateInterfaceFactory<shape_detection::mojom::BarcodeDetection>()); |
1207 AddUIThreadInterface( | 1214 AddUIThreadInterface( |
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2076 | 2083 |
2077 void RenderProcessHostImpl::OnAssociatedInterfaceRequest( | 2084 void RenderProcessHostImpl::OnAssociatedInterfaceRequest( |
2078 const std::string& interface_name, | 2085 const std::string& interface_name, |
2079 mojo::ScopedInterfaceEndpointHandle handle) { | 2086 mojo::ScopedInterfaceEndpointHandle handle) { |
2080 if (interface_name == mojom::RouteProvider::Name_) { | 2087 if (interface_name == mojom::RouteProvider::Name_) { |
2081 if (route_provider_binding_.is_bound()) | 2088 if (route_provider_binding_.is_bound()) |
2082 return; | 2089 return; |
2083 mojom::RouteProviderAssociatedRequest request; | 2090 mojom::RouteProviderAssociatedRequest request; |
2084 request.Bind(std::move(handle)); | 2091 request.Bind(std::move(handle)); |
2085 route_provider_binding_.Bind(std::move(request)); | 2092 route_provider_binding_.Bind(std::move(request)); |
| 2093 } else if (associated_registry_->CanBindRequest(interface_name)) { |
| 2094 associated_registry_->BindRequest(interface_name, std::move(handle)); |
2086 } else { | 2095 } else { |
2087 LOG(ERROR) << "Request for unknown Channel-associated interface: " | 2096 LOG(ERROR) << "Request for unknown Channel-associated interface: " |
2088 << interface_name; | 2097 << interface_name; |
2089 } | 2098 } |
2090 } | 2099 } |
2091 | 2100 |
2092 void RenderProcessHostImpl::OnChannelConnected(int32_t peer_pid) { | 2101 void RenderProcessHostImpl::OnChannelConnected(int32_t peer_pid) { |
2093 channel_connected_ = true; | 2102 channel_connected_ = true; |
2094 if (IsReady()) { | 2103 if (IsReady()) { |
2095 DCHECK(!sent_render_process_ready_); | 2104 DCHECK(!sent_render_process_ready_); |
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3083 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 3092 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
3084 | 3093 |
3085 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. | 3094 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. |
3086 // Capture the error message in a crash key value. | 3095 // Capture the error message in a crash key value. |
3087 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); | 3096 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); |
3088 bad_message::ReceivedBadMessage(render_process_id, | 3097 bad_message::ReceivedBadMessage(render_process_id, |
3089 bad_message::RPH_MOJO_PROCESS_ERROR); | 3098 bad_message::RPH_MOJO_PROCESS_ERROR); |
3090 } | 3099 } |
3091 | 3100 |
3092 } // namespace content | 3101 } // namespace content |
OLD | NEW |