OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 #include "content/browser/renderer_host/websocket_dispatcher_host.h" | 95 #include "content/browser/renderer_host/websocket_dispatcher_host.h" |
96 #include "content/browser/resolve_proxy_msg_helper.h" | 96 #include "content/browser/resolve_proxy_msg_helper.h" |
97 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 97 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
98 #include "content/browser/service_worker/service_worker_dispatcher_host.h" | 98 #include "content/browser/service_worker/service_worker_dispatcher_host.h" |
99 #include "content/browser/shared_worker/shared_worker_message_filter.h" | 99 #include "content/browser/shared_worker/shared_worker_message_filter.h" |
100 #include "content/browser/shared_worker/worker_storage_partition.h" | 100 #include "content/browser/shared_worker/worker_storage_partition.h" |
101 #include "content/browser/speech/speech_recognition_dispatcher_host.h" | 101 #include "content/browser/speech/speech_recognition_dispatcher_host.h" |
102 #include "content/browser/storage_partition_impl.h" | 102 #include "content/browser/storage_partition_impl.h" |
103 #include "content/browser/streams/stream_context.h" | 103 #include "content/browser/streams/stream_context.h" |
104 #include "content/browser/tracing/trace_message_filter.h" | 104 #include "content/browser/tracing/trace_message_filter.h" |
105 #include "content/browser/vibration/vibration_message_filter.h" | |
106 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 105 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
107 #include "content/common/child_process_host_impl.h" | 106 #include "content/common/child_process_host_impl.h" |
108 #include "content/common/child_process_messages.h" | 107 #include "content/common/child_process_messages.h" |
109 #include "content/common/content_switches_internal.h" | 108 #include "content/common/content_switches_internal.h" |
110 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 109 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
111 #include "content/common/gpu/gpu_messages.h" | 110 #include "content/common/gpu/gpu_messages.h" |
112 #include "content/common/mojo/mojo_messages.h" | 111 #include "content/common/mojo/mojo_messages.h" |
113 #include "content/common/resource_messages.h" | 112 #include "content/common/resource_messages.h" |
114 #include "content/common/view_messages.h" | 113 #include "content/common/view_messages.h" |
115 #include "content/public/browser/browser_context.h" | 114 #include "content/public/browser/browser_context.h" |
116 #include "content/public/browser/content_browser_client.h" | 115 #include "content/public/browser/content_browser_client.h" |
117 #include "content/public/browser/notification_service.h" | 116 #include "content/public/browser/notification_service.h" |
118 #include "content/public/browser/notification_types.h" | 117 #include "content/public/browser/notification_types.h" |
119 #include "content/public/browser/render_process_host_factory.h" | 118 #include "content/public/browser/render_process_host_factory.h" |
120 #include "content/public/browser/render_process_host_observer.h" | 119 #include "content/public/browser/render_process_host_observer.h" |
121 #include "content/public/browser/render_widget_host.h" | 120 #include "content/public/browser/render_widget_host.h" |
122 #include "content/public/browser/render_widget_host_iterator.h" | 121 #include "content/public/browser/render_widget_host_iterator.h" |
123 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 122 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" |
124 #include "content/public/browser/resource_context.h" | 123 #include "content/public/browser/resource_context.h" |
125 #include "content/public/browser/user_metrics.h" | 124 #include "content/public/browser/user_metrics.h" |
126 #include "content/public/browser/worker_service.h" | 125 #include "content/public/browser/worker_service.h" |
127 #include "content/public/common/content_constants.h" | 126 #include "content/public/common/content_constants.h" |
128 #include "content/public/common/content_switches.h" | 127 #include "content/public/common/content_switches.h" |
129 #include "content/public/common/process_type.h" | 128 #include "content/public/common/process_type.h" |
130 #include "content/public/common/resource_type.h" | 129 #include "content/public/common/resource_type.h" |
131 #include "content/public/common/result_codes.h" | 130 #include "content/public/common/result_codes.h" |
132 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 131 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
133 #include "content/public/common/url_constants.h" | 132 #include "content/public/common/url_constants.h" |
134 #include "device/battery/battery_monitor_impl.h" | 133 #include "device/battery/battery_monitor_impl.h" |
| 134 #include "device/vibration/vibration_manager_impl.h" |
135 #include "gpu/command_buffer/client/gpu_switches.h" | 135 #include "gpu/command_buffer/client/gpu_switches.h" |
136 #include "gpu/command_buffer/service/gpu_switches.h" | 136 #include "gpu/command_buffer/service/gpu_switches.h" |
137 #include "ipc/ipc_channel.h" | 137 #include "ipc/ipc_channel.h" |
138 #include "ipc/ipc_logging.h" | 138 #include "ipc/ipc_logging.h" |
139 #include "ipc/ipc_switches.h" | 139 #include "ipc/ipc_switches.h" |
140 #include "ipc/mojo/ipc_channel_mojo.h" | 140 #include "ipc/mojo/ipc_channel_mojo.h" |
141 #include "ipc/mojo/ipc_channel_mojo_host.h" | 141 #include "ipc/mojo/ipc_channel_mojo_host.h" |
142 #include "media/base/media_switches.h" | 142 #include "media/base/media_switches.h" |
143 #include "net/url_request/url_request_context_getter.h" | 143 #include "net/url_request/url_request_context_getter.h" |
144 #include "ppapi/shared_impl/ppapi_switches.h" | 144 #include "ppapi/shared_impl/ppapi_switches.h" |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 AddFilter(new GamepadBrowserMessageFilter()); | 864 AddFilter(new GamepadBrowserMessageFilter()); |
865 AddFilter(new DeviceLightMessageFilter()); | 865 AddFilter(new DeviceLightMessageFilter()); |
866 AddFilter(new DeviceMotionMessageFilter()); | 866 AddFilter(new DeviceMotionMessageFilter()); |
867 AddFilter(new DeviceOrientationMessageFilter()); | 867 AddFilter(new DeviceOrientationMessageFilter()); |
868 AddFilter(new ProfilerMessageFilter(PROCESS_TYPE_RENDERER)); | 868 AddFilter(new ProfilerMessageFilter(PROCESS_TYPE_RENDERER)); |
869 AddFilter(new HistogramMessageFilter()); | 869 AddFilter(new HistogramMessageFilter()); |
870 #if defined(USE_TCMALLOC) && (defined(OS_LINUX) || defined(OS_ANDROID)) | 870 #if defined(USE_TCMALLOC) && (defined(OS_LINUX) || defined(OS_ANDROID)) |
871 if (browser_command_line.HasSwitch(switches::kEnableMemoryBenchmarking)) | 871 if (browser_command_line.HasSwitch(switches::kEnableMemoryBenchmarking)) |
872 AddFilter(new MemoryBenchmarkMessageFilter()); | 872 AddFilter(new MemoryBenchmarkMessageFilter()); |
873 #endif | 873 #endif |
874 AddFilter(new VibrationMessageFilter()); | |
875 AddFilter(new PushMessagingMessageFilter( | 874 AddFilter(new PushMessagingMessageFilter( |
876 GetID(), storage_partition_impl_->GetServiceWorkerContext())); | 875 GetID(), storage_partition_impl_->GetServiceWorkerContext())); |
877 #if defined(OS_ANDROID) | 876 #if defined(OS_ANDROID) |
878 AddFilter(new ScreenOrientationMessageFilterAndroid()); | 877 AddFilter(new ScreenOrientationMessageFilterAndroid()); |
879 #endif | 878 #endif |
880 AddFilter(new GeofencingDispatcherHost( | 879 AddFilter(new GeofencingDispatcherHost( |
881 storage_partition_impl_->GetGeofencingManager())); | 880 storage_partition_impl_->GetGeofencingManager())); |
882 if (browser_command_line.HasSwitch( | 881 if (browser_command_line.HasSwitch( |
883 switches::kEnableExperimentalWebPlatformFeatures)) | 882 switches::kEnableExperimentalWebPlatformFeatures)) |
884 AddFilter(new BluetoothDispatcherHost()); | 883 AddFilter(new BluetoothDispatcherHost()); |
885 } | 884 } |
886 | 885 |
887 void RenderProcessHostImpl::RegisterMojoServices() { | 886 void RenderProcessHostImpl::RegisterMojoServices() { |
888 mojo_application_host_->service_registry()->AddService( | 887 mojo_application_host_->service_registry()->AddService( |
889 base::Bind(&device::BatteryMonitorImpl::Create)); | 888 base::Bind(&device::BatteryMonitorImpl::Create)); |
890 | 889 |
891 mojo_application_host_->service_registry()->AddService( | 890 mojo_application_host_->service_registry()->AddService( |
| 891 base::Bind(&device::VibrationManagerImpl::Create)); |
| 892 |
| 893 mojo_application_host_->service_registry()->AddService( |
892 base::Bind(&PermissionServiceContext::CreateService, | 894 base::Bind(&PermissionServiceContext::CreateService, |
893 base::Unretained(permission_service_context_.get()))); | 895 base::Unretained(permission_service_context_.get()))); |
894 | 896 |
895 GetContentClient()->browser()->OverrideRenderProcessMojoServices( | 897 GetContentClient()->browser()->OverrideRenderProcessMojoServices( |
896 mojo_application_host_->service_registry()); | 898 mojo_application_host_->service_registry()); |
897 } | 899 } |
898 | 900 |
899 int RenderProcessHostImpl::GetNextRoutingID() { | 901 int RenderProcessHostImpl::GetNextRoutingID() { |
900 return widget_helper_->GetNextRoutingID(); | 902 return widget_helper_->GetNextRoutingID(); |
901 } | 903 } |
(...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2295 | 2297 |
2296 void RenderProcessHostImpl::DecrementWorkerRefCount() { | 2298 void RenderProcessHostImpl::DecrementWorkerRefCount() { |
2297 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2299 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
2298 DCHECK_GT(worker_ref_count_, 0); | 2300 DCHECK_GT(worker_ref_count_, 0); |
2299 --worker_ref_count_; | 2301 --worker_ref_count_; |
2300 if (worker_ref_count_ == 0) | 2302 if (worker_ref_count_ == 0) |
2301 Cleanup(); | 2303 Cleanup(); |
2302 } | 2304 } |
2303 | 2305 |
2304 } // namespace content | 2306 } // namespace content |
OLD | NEW |