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 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( | 822 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( |
824 channel.get(), content::BrowserThread::GetMessageLoopProxyForThread( | 823 channel.get(), content::BrowserThread::GetMessageLoopProxyForThread( |
825 content::BrowserThread::IO)); | 824 content::BrowserThread::IO)); |
826 #endif | 825 #endif |
827 channel->Init(IPC::ChannelMojo::CreateServerFactory(std::move(handle)), true); | 826 channel->Init(IPC::ChannelMojo::CreateServerFactory(std::move(handle)), true); |
828 return channel; | 827 return channel; |
829 } | 828 } |
830 | 829 |
831 void RenderProcessHostImpl::CreateMessageFilters() { | 830 void RenderProcessHostImpl::CreateMessageFilters() { |
832 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 831 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
833 const base::CommandLine& browser_command_line = | |
834 *base::CommandLine::ForCurrentProcess(); | |
835 AddFilter(new ResourceSchedulerFilter(GetID())); | 832 AddFilter(new ResourceSchedulerFilter(GetID())); |
836 MediaInternals* media_internals = MediaInternals::GetInstance(); | 833 MediaInternals* media_internals = MediaInternals::GetInstance(); |
837 media::AudioManager* audio_manager = | 834 media::AudioManager* audio_manager = |
838 BrowserMainLoop::GetInstance()->audio_manager(); | 835 BrowserMainLoop::GetInstance()->audio_manager(); |
839 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages | 836 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages |
840 // from guests. | 837 // from guests. |
841 scoped_refptr<BrowserPluginMessageFilter> bp_message_filter( | 838 scoped_refptr<BrowserPluginMessageFilter> bp_message_filter( |
842 new BrowserPluginMessageFilter(GetID())); | 839 new BrowserPluginMessageFilter(GetID())); |
843 AddFilter(bp_message_filter.get()); | 840 AddFilter(bp_message_filter.get()); |
844 | 841 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 AddFilter(new DeviceOrientationMessageFilter()); | 1014 AddFilter(new DeviceOrientationMessageFilter()); |
1018 AddFilter(new DeviceOrientationAbsoluteMessageFilter()); | 1015 AddFilter(new DeviceOrientationAbsoluteMessageFilter()); |
1019 AddFilter(new ProfilerMessageFilter(PROCESS_TYPE_RENDERER)); | 1016 AddFilter(new ProfilerMessageFilter(PROCESS_TYPE_RENDERER)); |
1020 AddFilter(new HistogramMessageFilter()); | 1017 AddFilter(new HistogramMessageFilter()); |
1021 AddFilter(new MemoryMessageFilter(this)); | 1018 AddFilter(new MemoryMessageFilter(this)); |
1022 AddFilter(new PushMessagingMessageFilter( | 1019 AddFilter(new PushMessagingMessageFilter( |
1023 GetID(), storage_partition_impl_->GetServiceWorkerContext())); | 1020 GetID(), storage_partition_impl_->GetServiceWorkerContext())); |
1024 #if defined(OS_ANDROID) | 1021 #if defined(OS_ANDROID) |
1025 AddFilter(new ScreenOrientationMessageFilterAndroid()); | 1022 AddFilter(new ScreenOrientationMessageFilterAndroid()); |
1026 #endif | 1023 #endif |
1027 | |
1028 bool enable_web_bluetooth = | |
1029 browser_command_line.HasSwitch(switches::kEnableWebBluetooth); | |
1030 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) | |
1031 enable_web_bluetooth = true; | |
1032 #endif | |
1033 | |
1034 if (enable_web_bluetooth) { | |
1035 bluetooth_dispatcher_host_ = new BluetoothDispatcherHost(GetID()); | |
1036 AddFilter(bluetooth_dispatcher_host_.get()); | |
1037 } | |
1038 } | 1024 } |
1039 | 1025 |
1040 bool RenderProcessHostImpl::SendImpl(std::unique_ptr<IPC::Message> msg, | 1026 bool RenderProcessHostImpl::SendImpl(std::unique_ptr<IPC::Message> msg, |
1041 bool send_now) { | 1027 bool send_now) { |
1042 TRACE_EVENT0("renderer_host", "RenderProcessHostImpl::SendImpl"); | 1028 TRACE_EVENT0("renderer_host", "RenderProcessHostImpl::SendImpl"); |
1043 #if !defined(OS_ANDROID) | 1029 #if !defined(OS_ANDROID) |
1044 DCHECK(!msg->is_sync()); | 1030 DCHECK(!msg->is_sync()); |
1045 #endif | 1031 #endif |
1046 | 1032 |
1047 if (!channel_) { | 1033 if (!channel_) { |
(...skipping 1722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2770 return file.AddExtension(IntToStringType(base::GetProcId(GetHandle()))) | 2756 return file.AddExtension(IntToStringType(base::GetProcId(GetHandle()))) |
2771 .AddExtension(kEventLogFileNameAddition); | 2757 .AddExtension(kEventLogFileNameAddition); |
2772 } | 2758 } |
2773 #endif // defined(ENABLE_WEBRTC) | 2759 #endif // defined(ENABLE_WEBRTC) |
2774 | 2760 |
2775 void RenderProcessHostImpl::GetAudioOutputControllers( | 2761 void RenderProcessHostImpl::GetAudioOutputControllers( |
2776 const GetAudioOutputControllersCallback& callback) const { | 2762 const GetAudioOutputControllersCallback& callback) const { |
2777 audio_renderer_host()->GetOutputControllers(callback); | 2763 audio_renderer_host()->GetOutputControllers(callback); |
2778 } | 2764 } |
2779 | 2765 |
2780 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { | 2766 BluetoothAdapterFactoryWrapper* |
2781 return bluetooth_dispatcher_host_.get(); | 2767 RenderProcessHostImpl::GetBluetoothAdapterFactoryWrapper() { |
| 2768 return &bluetooth_adapter_factory_wrapper_; |
2782 } | 2769 } |
2783 | 2770 |
2784 void RenderProcessHostImpl::RecomputeAndUpdateWebKitPreferences() { | 2771 void RenderProcessHostImpl::RecomputeAndUpdateWebKitPreferences() { |
2785 // We are updating all widgets including swapped out ones. | 2772 // We are updating all widgets including swapped out ones. |
2786 std::unique_ptr<RenderWidgetHostIterator> widgets( | 2773 std::unique_ptr<RenderWidgetHostIterator> widgets( |
2787 RenderWidgetHostImpl::GetAllRenderWidgetHosts()); | 2774 RenderWidgetHostImpl::GetAllRenderWidgetHosts()); |
2788 while (RenderWidgetHost* widget = widgets->GetNextHost()) { | 2775 while (RenderWidgetHost* widget = widgets->GetNextHost()) { |
2789 RenderViewHost* rvh = RenderViewHost::From(widget); | 2776 RenderViewHost* rvh = RenderViewHost::From(widget); |
2790 if (!rvh) | 2777 if (!rvh) |
2791 continue; | 2778 continue; |
2792 | 2779 |
2793 // Skip widgets in other processes. | 2780 // Skip widgets in other processes. |
2794 if (rvh->GetProcess()->GetID() != GetID()) | 2781 if (rvh->GetProcess()->GetID() != GetID()) |
2795 continue; | 2782 continue; |
2796 | 2783 |
2797 rvh->OnWebkitPreferencesChanged(); | 2784 rvh->OnWebkitPreferencesChanged(); |
2798 } | 2785 } |
2799 } | 2786 } |
2800 | 2787 |
2801 } // namespace content | 2788 } // namespace content |
OLD | NEW |