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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 #include "build/build_config.h" | 44 #include "build/build_config.h" |
45 #include "cc/base/switches.h" | 45 #include "cc/base/switches.h" |
46 #include "components/scheduler/common/scheduler_switches.h" | 46 #include "components/scheduler/common/scheduler_switches.h" |
47 #include "components/tracing/tracing_switches.h" | 47 #include "components/tracing/tracing_switches.h" |
48 #include "content/browser/appcache/appcache_dispatcher_host.h" | 48 #include "content/browser/appcache/appcache_dispatcher_host.h" |
49 #include "content/browser/appcache/chrome_appcache_service.h" | 49 #include "content/browser/appcache/chrome_appcache_service.h" |
50 #include "content/browser/background_sync/background_sync_service_impl.h" | 50 #include "content/browser/background_sync/background_sync_service_impl.h" |
51 #include "content/browser/bad_message.h" | 51 #include "content/browser/bad_message.h" |
52 #include "content/browser/blob_storage/blob_dispatcher_host.h" | 52 #include "content/browser/blob_storage/blob_dispatcher_host.h" |
53 #include "content/browser/blob_storage/chrome_blob_storage_context.h" | 53 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
54 #include "content/browser/bluetooth/bluetooth_dispatcher_host.h" | |
55 #include "content/browser/browser_child_process_host_impl.h" | 54 #include "content/browser/browser_child_process_host_impl.h" |
56 #include "content/browser/browser_main.h" | 55 #include "content/browser/browser_main.h" |
57 #include "content/browser/browser_main_loop.h" | 56 #include "content/browser/browser_main_loop.h" |
58 #include "content/browser/browser_plugin/browser_plugin_message_filter.h" | 57 #include "content/browser/browser_plugin/browser_plugin_message_filter.h" |
59 #include "content/browser/cache_storage/cache_storage_context_impl.h" | 58 #include "content/browser/cache_storage/cache_storage_context_impl.h" |
60 #include "content/browser/cache_storage/cache_storage_dispatcher_host.h" | 59 #include "content/browser/cache_storage/cache_storage_dispatcher_host.h" |
61 #include "content/browser/child_process_security_policy_impl.h" | 60 #include "content/browser/child_process_security_policy_impl.h" |
62 #include "content/browser/device_sensors/device_light_message_filter.h" | 61 #include "content/browser/device_sensors/device_light_message_filter.h" |
63 #include "content/browser/device_sensors/device_motion_message_filter.h" | 62 #include "content/browser/device_sensors/device_motion_message_filter.h" |
64 #include "content/browser/device_sensors/device_orientation_absolute_message_fil ter.h" | 63 #include "content/browser/device_sensors/device_orientation_absolute_message_fil ter.h" |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
803 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( | 802 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( |
804 channel.get(), content::BrowserThread::GetMessageLoopProxyForThread( | 803 channel.get(), content::BrowserThread::GetMessageLoopProxyForThread( |
805 content::BrowserThread::IO)); | 804 content::BrowserThread::IO)); |
806 #endif | 805 #endif |
807 channel->Init(IPC::ChannelMojo::CreateServerFactory(std::move(handle)), true); | 806 channel->Init(IPC::ChannelMojo::CreateServerFactory(std::move(handle)), true); |
808 return channel; | 807 return channel; |
809 } | 808 } |
810 | 809 |
811 void RenderProcessHostImpl::CreateMessageFilters() { | 810 void RenderProcessHostImpl::CreateMessageFilters() { |
812 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 811 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
813 const base::CommandLine& browser_command_line = | |
814 *base::CommandLine::ForCurrentProcess(); | |
815 AddFilter(new ResourceSchedulerFilter(GetID())); | 812 AddFilter(new ResourceSchedulerFilter(GetID())); |
816 MediaInternals* media_internals = MediaInternals::GetInstance(); | 813 MediaInternals* media_internals = MediaInternals::GetInstance(); |
817 media::AudioManager* audio_manager = | 814 media::AudioManager* audio_manager = |
818 BrowserMainLoop::GetInstance()->audio_manager(); | 815 BrowserMainLoop::GetInstance()->audio_manager(); |
819 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages | 816 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages |
820 // from guests. | 817 // from guests. |
821 scoped_refptr<BrowserPluginMessageFilter> bp_message_filter( | 818 scoped_refptr<BrowserPluginMessageFilter> bp_message_filter( |
822 new BrowserPluginMessageFilter(GetID())); | 819 new BrowserPluginMessageFilter(GetID())); |
823 AddFilter(bp_message_filter.get()); | 820 AddFilter(bp_message_filter.get()); |
824 | 821 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
995 AddFilter(new DeviceOrientationMessageFilter()); | 992 AddFilter(new DeviceOrientationMessageFilter()); |
996 AddFilter(new DeviceOrientationAbsoluteMessageFilter()); | 993 AddFilter(new DeviceOrientationAbsoluteMessageFilter()); |
997 AddFilter(new ProfilerMessageFilter(PROCESS_TYPE_RENDERER)); | 994 AddFilter(new ProfilerMessageFilter(PROCESS_TYPE_RENDERER)); |
998 AddFilter(new HistogramMessageFilter()); | 995 AddFilter(new HistogramMessageFilter()); |
999 AddFilter(new MemoryMessageFilter(this)); | 996 AddFilter(new MemoryMessageFilter(this)); |
1000 AddFilter(new PushMessagingMessageFilter( | 997 AddFilter(new PushMessagingMessageFilter( |
1001 GetID(), storage_partition_impl_->GetServiceWorkerContext())); | 998 GetID(), storage_partition_impl_->GetServiceWorkerContext())); |
1002 #if defined(OS_ANDROID) | 999 #if defined(OS_ANDROID) |
1003 AddFilter(new ScreenOrientationMessageFilterAndroid()); | 1000 AddFilter(new ScreenOrientationMessageFilterAndroid()); |
1004 #endif | 1001 #endif |
1005 | |
1006 bool enable_web_bluetooth = | |
1007 browser_command_line.HasSwitch(switches::kEnableWebBluetooth); | |
1008 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) | |
1009 enable_web_bluetooth = true; | |
1010 #endif | |
1011 | |
1012 if (enable_web_bluetooth) { | |
1013 bluetooth_dispatcher_host_ = new BluetoothDispatcherHost(GetID()); | |
1014 AddFilter(bluetooth_dispatcher_host_.get()); | |
1015 } | |
1016 } | 1002 } |
1017 | 1003 |
1018 void RenderProcessHostImpl::RegisterMojoServices() { | 1004 void RenderProcessHostImpl::RegisterMojoServices() { |
1019 #if !defined(OS_ANDROID) | 1005 #if !defined(OS_ANDROID) |
1020 mojo_application_host_->service_registry()->AddService( | 1006 mojo_application_host_->service_registry()->AddService( |
1021 base::Bind(&device::BatteryMonitorImpl::Create)); | 1007 base::Bind(&device::BatteryMonitorImpl::Create)); |
1022 #endif | 1008 #endif |
1023 | 1009 |
1024 mojo_application_host_->service_registry()->AddService( | 1010 mojo_application_host_->service_registry()->AddService( |
1025 base::Bind(&PermissionServiceContext::CreateService, | 1011 base::Bind(&PermissionServiceContext::CreateService, |
(...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2739 return file.AddExtension(IntToStringType(base::GetProcId(GetHandle()))) | 2725 return file.AddExtension(IntToStringType(base::GetProcId(GetHandle()))) |
2740 .AddExtension(kEventLogFileNameAddition); | 2726 .AddExtension(kEventLogFileNameAddition); |
2741 } | 2727 } |
2742 #endif // defined(ENABLE_WEBRTC) | 2728 #endif // defined(ENABLE_WEBRTC) |
2743 | 2729 |
2744 void RenderProcessHostImpl::GetAudioOutputControllers( | 2730 void RenderProcessHostImpl::GetAudioOutputControllers( |
2745 const GetAudioOutputControllersCallback& callback) const { | 2731 const GetAudioOutputControllersCallback& callback) const { |
2746 audio_renderer_host()->GetOutputControllers(callback); | 2732 audio_renderer_host()->GetOutputControllers(callback); |
2747 } | 2733 } |
2748 | 2734 |
2749 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { | 2735 BluetoothAdapterFactoryWrapper& |
2750 return bluetooth_dispatcher_host_.get(); | 2736 RenderProcessHostImpl::GetBluetoothAdapterFactoryWrapper() { |
2737 return bluetooth_adapter_factory_wrapper_; | |
ncarter (slow)
2016/05/25 21:19:18
Given that you've removed the reset-on-process-rel
ortuno
2016/05/26 20:31:01
Done.
| |
2751 } | 2738 } |
2752 | 2739 |
2753 void RenderProcessHostImpl::RecomputeAndUpdateWebKitPreferences() { | 2740 void RenderProcessHostImpl::RecomputeAndUpdateWebKitPreferences() { |
2754 // We are updating all widgets including swapped out ones. | 2741 // We are updating all widgets including swapped out ones. |
2755 std::unique_ptr<RenderWidgetHostIterator> widgets( | 2742 std::unique_ptr<RenderWidgetHostIterator> widgets( |
2756 RenderWidgetHostImpl::GetAllRenderWidgetHosts()); | 2743 RenderWidgetHostImpl::GetAllRenderWidgetHosts()); |
2757 while (RenderWidgetHost* widget = widgets->GetNextHost()) { | 2744 while (RenderWidgetHost* widget = widgets->GetNextHost()) { |
2758 RenderViewHost* rvh = RenderViewHost::From(widget); | 2745 RenderViewHost* rvh = RenderViewHost::From(widget); |
2759 if (!rvh) | 2746 if (!rvh) |
2760 continue; | 2747 continue; |
2761 | 2748 |
2762 // Skip widgets in other processes. | 2749 // Skip widgets in other processes. |
2763 if (rvh->GetProcess()->GetID() != GetID()) | 2750 if (rvh->GetProcess()->GetID() != GetID()) |
2764 continue; | 2751 continue; |
2765 | 2752 |
2766 rvh->OnWebkitPreferencesChanged(); | 2753 rvh->OnWebkitPreferencesChanged(); |
2767 } | 2754 } |
2768 } | 2755 } |
2769 | 2756 |
2770 } // namespace content | 2757 } // namespace content |
OLD | NEW |