| 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 17 matching lines...) Expand all Loading... |
| 28 #include "base/strings/string_number_conversions.h" | 28 #include "base/strings/string_number_conversions.h" |
| 29 #include "base/strings/string_util.h" | 29 #include "base/strings/string_util.h" |
| 30 #include "base/supports_user_data.h" | 30 #include "base/supports_user_data.h" |
| 31 #include "base/sys_info.h" | 31 #include "base/sys_info.h" |
| 32 #include "base/threading/thread.h" | 32 #include "base/threading/thread.h" |
| 33 #include "base/threading/thread_restrictions.h" | 33 #include "base/threading/thread_restrictions.h" |
| 34 #include "base/tracked_objects.h" | 34 #include "base/tracked_objects.h" |
| 35 #include "cc/base/switches.h" | 35 #include "cc/base/switches.h" |
| 36 #include "content/browser/appcache/appcache_dispatcher_host.h" | 36 #include "content/browser/appcache/appcache_dispatcher_host.h" |
| 37 #include "content/browser/appcache/chrome_appcache_service.h" | 37 #include "content/browser/appcache/chrome_appcache_service.h" |
| 38 #include "content/browser/bluetooth/bluetooth_dispatcher_host.h" |
| 38 #include "content/browser/browser_child_process_host_impl.h" | 39 #include "content/browser/browser_child_process_host_impl.h" |
| 39 #include "content/browser/browser_main.h" | 40 #include "content/browser/browser_main.h" |
| 40 #include "content/browser/browser_main_loop.h" | 41 #include "content/browser/browser_main_loop.h" |
| 41 #include "content/browser/browser_plugin/browser_plugin_message_filter.h" | 42 #include "content/browser/browser_plugin/browser_plugin_message_filter.h" |
| 42 #include "content/browser/child_process_security_policy_impl.h" | 43 #include "content/browser/child_process_security_policy_impl.h" |
| 43 #include "content/browser/device_sensors/device_light_message_filter.h" | 44 #include "content/browser/device_sensors/device_light_message_filter.h" |
| 44 #include "content/browser/device_sensors/device_motion_message_filter.h" | 45 #include "content/browser/device_sensors/device_motion_message_filter.h" |
| 45 #include "content/browser/device_sensors/device_orientation_message_filter.h" | 46 #include "content/browser/device_sensors/device_orientation_message_filter.h" |
| 46 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 47 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
| 47 #include "content/browser/dom_storage/dom_storage_message_filter.h" | 48 #include "content/browser/dom_storage/dom_storage_message_filter.h" |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 this, | 668 this, |
| 668 runner.get()); | 669 runner.get()); |
| 669 } | 670 } |
| 670 | 671 |
| 671 return IPC::ChannelProxy::Create( | 672 return IPC::ChannelProxy::Create( |
| 672 channel_id, IPC::Channel::MODE_SERVER, this, runner.get()); | 673 channel_id, IPC::Channel::MODE_SERVER, this, runner.get()); |
| 673 } | 674 } |
| 674 | 675 |
| 675 void RenderProcessHostImpl::CreateMessageFilters() { | 676 void RenderProcessHostImpl::CreateMessageFilters() { |
| 676 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 677 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 678 const base::CommandLine& browser_command_line = |
| 679 *base::CommandLine::ForCurrentProcess(); |
| 677 AddFilter(new ResourceSchedulerFilter(GetID())); | 680 AddFilter(new ResourceSchedulerFilter(GetID())); |
| 678 MediaInternals* media_internals = MediaInternals::GetInstance(); | 681 MediaInternals* media_internals = MediaInternals::GetInstance(); |
| 679 media::AudioManager* audio_manager = | 682 media::AudioManager* audio_manager = |
| 680 BrowserMainLoop::GetInstance()->audio_manager(); | 683 BrowserMainLoop::GetInstance()->audio_manager(); |
| 681 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages | 684 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages |
| 682 // from guests. | 685 // from guests. |
| 683 scoped_refptr<BrowserPluginMessageFilter> bp_message_filter( | 686 scoped_refptr<BrowserPluginMessageFilter> bp_message_filter( |
| 684 new BrowserPluginMessageFilter(GetID())); | 687 new BrowserPluginMessageFilter(GetID())); |
| 685 AddFilter(bp_message_filter.get()); | 688 AddFilter(bp_message_filter.get()); |
| 686 | 689 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 browser_context); | 858 browser_context); |
| 856 AddFilter(notification_message_filter_.get()); | 859 AddFilter(notification_message_filter_.get()); |
| 857 | 860 |
| 858 AddFilter(new GamepadBrowserMessageFilter()); | 861 AddFilter(new GamepadBrowserMessageFilter()); |
| 859 AddFilter(new DeviceLightMessageFilter()); | 862 AddFilter(new DeviceLightMessageFilter()); |
| 860 AddFilter(new DeviceMotionMessageFilter()); | 863 AddFilter(new DeviceMotionMessageFilter()); |
| 861 AddFilter(new DeviceOrientationMessageFilter()); | 864 AddFilter(new DeviceOrientationMessageFilter()); |
| 862 AddFilter(new ProfilerMessageFilter(PROCESS_TYPE_RENDERER)); | 865 AddFilter(new ProfilerMessageFilter(PROCESS_TYPE_RENDERER)); |
| 863 AddFilter(new HistogramMessageFilter()); | 866 AddFilter(new HistogramMessageFilter()); |
| 864 #if defined(USE_TCMALLOC) && (defined(OS_LINUX) || defined(OS_ANDROID)) | 867 #if defined(USE_TCMALLOC) && (defined(OS_LINUX) || defined(OS_ANDROID)) |
| 865 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 868 if (browser_command_line.HasSwitch(switches::kEnableMemoryBenchmarking)) |
| 866 switches::kEnableMemoryBenchmarking)) | |
| 867 AddFilter(new MemoryBenchmarkMessageFilter()); | 869 AddFilter(new MemoryBenchmarkMessageFilter()); |
| 868 #endif | 870 #endif |
| 869 AddFilter(new VibrationMessageFilter()); | 871 AddFilter(new VibrationMessageFilter()); |
| 870 AddFilter(new PushMessagingMessageFilter( | 872 AddFilter(new PushMessagingMessageFilter( |
| 871 GetID(), storage_partition_impl_->GetServiceWorkerContext())); | 873 GetID(), storage_partition_impl_->GetServiceWorkerContext())); |
| 872 #if defined(OS_ANDROID) | 874 #if defined(OS_ANDROID) |
| 873 AddFilter(new ScreenOrientationMessageFilterAndroid()); | 875 AddFilter(new ScreenOrientationMessageFilterAndroid()); |
| 874 #endif | 876 #endif |
| 875 AddFilter(new GeofencingDispatcherHost( | 877 AddFilter(new GeofencingDispatcherHost( |
| 876 storage_partition_impl_->GetGeofencingManager())); | 878 storage_partition_impl_->GetGeofencingManager())); |
| 879 if (browser_command_line.HasSwitch( |
| 880 switches::kEnableExperimentalWebPlatformFeatures)) |
| 881 AddFilter(new BluetoothDispatcherHost()); |
| 877 } | 882 } |
| 878 | 883 |
| 879 void RenderProcessHostImpl::RegisterMojoServices() { | 884 void RenderProcessHostImpl::RegisterMojoServices() { |
| 880 mojo_application_host_->service_registry()->AddService( | 885 mojo_application_host_->service_registry()->AddService( |
| 881 base::Bind(&device::BatteryMonitorImpl::Create)); | 886 base::Bind(&device::BatteryMonitorImpl::Create)); |
| 882 | 887 |
| 883 mojo_application_host_->service_registry()->AddService( | 888 mojo_application_host_->service_registry()->AddService( |
| 884 base::Bind(&PermissionServiceContext::CreateService, | 889 base::Bind(&PermissionServiceContext::CreateService, |
| 885 base::Unretained(permission_service_context_.get()))); | 890 base::Unretained(permission_service_context_.get()))); |
| 886 } | 891 } |
| (...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2247 | 2252 |
| 2248 void RenderProcessHostImpl::DecrementWorkerRefCount() { | 2253 void RenderProcessHostImpl::DecrementWorkerRefCount() { |
| 2249 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2254 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 2250 DCHECK_GT(worker_ref_count_, 0); | 2255 DCHECK_GT(worker_ref_count_, 0); |
| 2251 --worker_ref_count_; | 2256 --worker_ref_count_; |
| 2252 if (worker_ref_count_ == 0) | 2257 if (worker_ref_count_ == 0) |
| 2253 Cleanup(); | 2258 Cleanup(); |
| 2254 } | 2259 } |
| 2255 | 2260 |
| 2256 } // namespace content | 2261 } // namespace content |
| OLD | NEW |