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" |
105 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 106 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
106 #include "content/common/child_process_host_impl.h" | 107 #include "content/common/child_process_host_impl.h" |
107 #include "content/common/child_process_messages.h" | 108 #include "content/common/child_process_messages.h" |
108 #include "content/common/content_switches_internal.h" | 109 #include "content/common/content_switches_internal.h" |
109 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 110 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
110 #include "content/common/gpu/gpu_messages.h" | 111 #include "content/common/gpu/gpu_messages.h" |
111 #include "content/common/mojo/mojo_messages.h" | 112 #include "content/common/mojo/mojo_messages.h" |
112 #include "content/common/resource_messages.h" | 113 #include "content/common/resource_messages.h" |
113 #include "content/common/view_messages.h" | 114 #include "content/common/view_messages.h" |
114 #include "content/public/browser/browser_context.h" | 115 #include "content/public/browser/browser_context.h" |
115 #include "content/public/browser/content_browser_client.h" | 116 #include "content/public/browser/content_browser_client.h" |
116 #include "content/public/browser/notification_service.h" | 117 #include "content/public/browser/notification_service.h" |
117 #include "content/public/browser/notification_types.h" | 118 #include "content/public/browser/notification_types.h" |
118 #include "content/public/browser/render_process_host_factory.h" | 119 #include "content/public/browser/render_process_host_factory.h" |
119 #include "content/public/browser/render_process_host_observer.h" | 120 #include "content/public/browser/render_process_host_observer.h" |
120 #include "content/public/browser/render_widget_host.h" | 121 #include "content/public/browser/render_widget_host.h" |
121 #include "content/public/browser/render_widget_host_iterator.h" | 122 #include "content/public/browser/render_widget_host_iterator.h" |
122 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 123 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" |
123 #include "content/public/browser/resource_context.h" | 124 #include "content/public/browser/resource_context.h" |
124 #include "content/public/browser/user_metrics.h" | 125 #include "content/public/browser/user_metrics.h" |
125 #include "content/public/browser/worker_service.h" | 126 #include "content/public/browser/worker_service.h" |
126 #include "content/public/common/content_constants.h" | 127 #include "content/public/common/content_constants.h" |
127 #include "content/public/common/content_switches.h" | 128 #include "content/public/common/content_switches.h" |
128 #include "content/public/common/process_type.h" | 129 #include "content/public/common/process_type.h" |
129 #include "content/public/common/resource_type.h" | 130 #include "content/public/common/resource_type.h" |
130 #include "content/public/common/result_codes.h" | 131 #include "content/public/common/result_codes.h" |
131 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 132 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
132 #include "content/public/common/url_constants.h" | 133 #include "content/public/common/url_constants.h" |
133 #include "device/battery/battery_monitor_impl.h" | 134 #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()); |
874 AddFilter(new PushMessagingMessageFilter( | 875 AddFilter(new PushMessagingMessageFilter( |
875 GetID(), storage_partition_impl_->GetServiceWorkerContext())); | 876 GetID(), storage_partition_impl_->GetServiceWorkerContext())); |
876 #if defined(OS_ANDROID) | 877 #if defined(OS_ANDROID) |
877 AddFilter(new ScreenOrientationMessageFilterAndroid()); | 878 AddFilter(new ScreenOrientationMessageFilterAndroid()); |
878 #endif | 879 #endif |
879 AddFilter(new GeofencingDispatcherHost( | 880 AddFilter(new GeofencingDispatcherHost( |
880 storage_partition_impl_->GetGeofencingManager())); | 881 storage_partition_impl_->GetGeofencingManager())); |
881 if (browser_command_line.HasSwitch( | 882 if (browser_command_line.HasSwitch( |
882 switches::kEnableExperimentalWebPlatformFeatures)) | 883 switches::kEnableExperimentalWebPlatformFeatures)) |
883 AddFilter(new BluetoothDispatcherHost()); | 884 AddFilter(new BluetoothDispatcherHost()); |
884 } | 885 } |
885 | 886 |
886 void RenderProcessHostImpl::RegisterMojoServices() { | 887 void RenderProcessHostImpl::RegisterMojoServices() { |
887 mojo_application_host_->service_registry()->AddService( | 888 mojo_application_host_->service_registry()->AddService( |
888 base::Bind(&device::BatteryMonitorImpl::Create)); | 889 base::Bind(&device::BatteryMonitorImpl::Create)); |
889 | 890 |
890 mojo_application_host_->service_registry()->AddService( | 891 mojo_application_host_->service_registry()->AddService( |
891 base::Bind(&device::VibrationManagerImpl::Create)); | |
892 | |
893 mojo_application_host_->service_registry()->AddService( | |
894 base::Bind(&PermissionServiceContext::CreateService, | 892 base::Bind(&PermissionServiceContext::CreateService, |
895 base::Unretained(permission_service_context_.get()))); | 893 base::Unretained(permission_service_context_.get()))); |
896 | 894 |
897 GetContentClient()->browser()->OverrideRenderProcessMojoServices( | 895 GetContentClient()->browser()->OverrideRenderProcessMojoServices( |
898 mojo_application_host_->service_registry()); | 896 mojo_application_host_->service_registry()); |
899 } | 897 } |
900 | 898 |
901 int RenderProcessHostImpl::GetNextRoutingID() { | 899 int RenderProcessHostImpl::GetNextRoutingID() { |
902 return widget_helper_->GetNextRoutingID(); | 900 return widget_helper_->GetNextRoutingID(); |
903 } | 901 } |
(...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2297 | 2295 |
2298 void RenderProcessHostImpl::DecrementWorkerRefCount() { | 2296 void RenderProcessHostImpl::DecrementWorkerRefCount() { |
2299 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2297 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
2300 DCHECK_GT(worker_ref_count_, 0); | 2298 DCHECK_GT(worker_ref_count_, 0); |
2301 --worker_ref_count_; | 2299 --worker_ref_count_; |
2302 if (worker_ref_count_ == 0) | 2300 if (worker_ref_count_ == 0) |
2303 Cleanup(); | 2301 Cleanup(); |
2304 } | 2302 } |
2305 | 2303 |
2306 } // namespace content | 2304 } // namespace content |
OLD | NEW |