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 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 // The FontCacheDispatcher is required only when we're using GDI rendering. | 841 // The FontCacheDispatcher is required only when we're using GDI rendering. |
842 // TODO(scottmg): pdf/ppapi still require the renderer to be able to precache | 842 // TODO(scottmg): pdf/ppapi still require the renderer to be able to precache |
843 // GDI fonts (http://crbug.com/383227), even when using DirectWrite. This | 843 // GDI fonts (http://crbug.com/383227), even when using DirectWrite. This |
844 // should eventually be if (!ShouldUseDirectWrite()) guarded. | 844 // should eventually be if (!ShouldUseDirectWrite()) guarded. |
845 channel_->AddFilter(new FontCacheDispatcher()); | 845 channel_->AddFilter(new FontCacheDispatcher()); |
846 #elif defined(OS_ANDROID) | 846 #elif defined(OS_ANDROID) |
847 browser_demuxer_android_ = new BrowserDemuxerAndroid(); | 847 browser_demuxer_android_ = new BrowserDemuxerAndroid(); |
848 AddFilter(browser_demuxer_android_.get()); | 848 AddFilter(browser_demuxer_android_.get()); |
849 #endif | 849 #endif |
850 #if defined(ENABLE_BROWSER_CDMS) | 850 #if defined(ENABLE_BROWSER_CDMS) |
851 browser_cdm_manager_ = new BrowserCdmManager(GetID(), NULL); | 851 AddFilter(new BrowserCdmManager(GetID(), NULL)); |
852 AddFilter(browser_cdm_manager_.get()); | |
853 #endif | 852 #endif |
854 | 853 |
855 WebSocketDispatcherHost::GetRequestContextCallback | 854 WebSocketDispatcherHost::GetRequestContextCallback |
856 websocket_request_context_callback( | 855 websocket_request_context_callback( |
857 base::Bind(&GetRequestContext, request_context, | 856 base::Bind(&GetRequestContext, request_context, |
858 media_request_context, RESOURCE_TYPE_SUB_RESOURCE)); | 857 media_request_context, RESOURCE_TYPE_SUB_RESOURCE)); |
859 | 858 |
860 AddFilter( | 859 AddFilter( |
861 new WebSocketDispatcherHost(GetID(), websocket_request_context_callback)); | 860 new WebSocketDispatcherHost(GetID(), websocket_request_context_callback)); |
862 | 861 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 } else { | 1016 } else { |
1018 // Store the ValueState locally in case a Valuebuffer subscribes to it later | 1017 // Store the ValueState locally in case a Valuebuffer subscribes to it later |
1019 pending_valuebuffer_state_->UpdateState(target, state); | 1018 pending_valuebuffer_state_->UpdateState(target, state); |
1020 } | 1019 } |
1021 } | 1020 } |
1022 | 1021 |
1023 #if defined(ENABLE_BROWSER_CDMS) | 1022 #if defined(ENABLE_BROWSER_CDMS) |
1024 media::BrowserCdm* RenderProcessHostImpl::GetBrowserCdm(int render_frame_id, | 1023 media::BrowserCdm* RenderProcessHostImpl::GetBrowserCdm(int render_frame_id, |
1025 int cdm_id) const { | 1024 int cdm_id) const { |
1026 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1025 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
1027 return browser_cdm_manager_->GetCdm(render_frame_id, cdm_id); | 1026 BrowserCdmManager* manager = BrowserCdmManager::FromProcess(GetID()); |
| 1027 if (!manager) |
| 1028 return nullptr; |
| 1029 return manager->GetCdm(render_frame_id, cdm_id); |
1028 } | 1030 } |
1029 #endif | 1031 #endif |
1030 | 1032 |
1031 void RenderProcessHostImpl::AddRoute( | 1033 void RenderProcessHostImpl::AddRoute( |
1032 int32 routing_id, | 1034 int32 routing_id, |
1033 IPC::Listener* listener) { | 1035 IPC::Listener* listener) { |
1034 CHECK(!listeners_.Lookup(routing_id)) | 1036 CHECK(!listeners_.Lookup(routing_id)) |
1035 << "Found Routing ID Conflict: " << routing_id; | 1037 << "Found Routing ID Conflict: " << routing_id; |
1036 listeners_.AddWithID(listener, routing_id); | 1038 listeners_.AddWithID(listener, routing_id); |
1037 } | 1039 } |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1679 // It's important not to wait for the DeleteTask to delete the channel | 1681 // It's important not to wait for the DeleteTask to delete the channel |
1680 // proxy. Kill it off now. That way, in case the profile is going away, the | 1682 // proxy. Kill it off now. That way, in case the profile is going away, the |
1681 // rest of the objects attached to this RenderProcessHost start going | 1683 // rest of the objects attached to this RenderProcessHost start going |
1682 // away first, since deleting the channel proxy will post a | 1684 // away first, since deleting the channel proxy will post a |
1683 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. | 1685 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. |
1684 channel_.reset(); | 1686 channel_.reset(); |
1685 | 1687 |
1686 // The following members should be cleared in ProcessDied() as well! | 1688 // The following members should be cleared in ProcessDied() as well! |
1687 gpu_message_filter_ = NULL; | 1689 gpu_message_filter_ = NULL; |
1688 message_port_message_filter_ = NULL; | 1690 message_port_message_filter_ = NULL; |
1689 #if defined(ENABLE_BROWSER_CDMS) | |
1690 browser_cdm_manager_ = NULL; | |
1691 #endif | |
1692 | 1691 |
1693 RemoveUserData(kSessionStorageHolderKey); | 1692 RemoveUserData(kSessionStorageHolderKey); |
1694 | 1693 |
1695 // Remove ourself from the list of renderer processes so that we can't be | 1694 // Remove ourself from the list of renderer processes so that we can't be |
1696 // reused in between now and when the Delete task runs. | 1695 // reused in between now and when the Delete task runs. |
1697 UnregisterHost(GetID()); | 1696 UnregisterHost(GetID()); |
1698 | 1697 |
1699 #if defined(OS_MACOSX) && !defined(OS_IOS) | 1698 #if defined(OS_MACOSX) && !defined(OS_IOS) |
1700 if (!io_surface_manager_token_.IsZero()) { | 1699 if (!io_surface_manager_token_.IsZero()) { |
1701 BrowserIOSurfaceManager::GetInstance()->InvalidateChildProcessToken( | 1700 BrowserIOSurfaceManager::GetInstance()->InvalidateChildProcessToken( |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2122 NOTIFICATION_RENDERER_PROCESS_CLOSED, | 2121 NOTIFICATION_RENDERER_PROCESS_CLOSED, |
2123 Source<RenderProcessHost>(this), | 2122 Source<RenderProcessHost>(this), |
2124 Details<RendererClosedDetails>(&details)); | 2123 Details<RendererClosedDetails>(&details)); |
2125 FOR_EACH_OBSERVER(RenderProcessHostObserver, | 2124 FOR_EACH_OBSERVER(RenderProcessHostObserver, |
2126 observers_, | 2125 observers_, |
2127 RenderProcessExited(this, status, exit_code)); | 2126 RenderProcessExited(this, status, exit_code)); |
2128 within_process_died_observer_ = false; | 2127 within_process_died_observer_ = false; |
2129 | 2128 |
2130 gpu_message_filter_ = NULL; | 2129 gpu_message_filter_ = NULL; |
2131 message_port_message_filter_ = NULL; | 2130 message_port_message_filter_ = NULL; |
2132 #if defined(ENABLE_BROWSER_CDMS) | |
2133 browser_cdm_manager_ = NULL; | |
2134 #endif | |
2135 RemoveUserData(kSessionStorageHolderKey); | 2131 RemoveUserData(kSessionStorageHolderKey); |
2136 | 2132 |
2137 IDMap<IPC::Listener>::iterator iter(&listeners_); | 2133 IDMap<IPC::Listener>::iterator iter(&listeners_); |
2138 while (!iter.IsAtEnd()) { | 2134 while (!iter.IsAtEnd()) { |
2139 iter.GetCurrentValue()->OnMessageReceived( | 2135 iter.GetCurrentValue()->OnMessageReceived( |
2140 FrameHostMsg_RenderProcessGone(iter.GetCurrentKey(), | 2136 FrameHostMsg_RenderProcessGone(iter.GetCurrentKey(), |
2141 static_cast<int>(status), | 2137 static_cast<int>(status), |
2142 exit_code)); | 2138 exit_code)); |
2143 iter.Advance(); | 2139 iter.Advance(); |
2144 } | 2140 } |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2514 void RenderProcessHostImpl::GetAudioOutputControllers( | 2510 void RenderProcessHostImpl::GetAudioOutputControllers( |
2515 const GetAudioOutputControllersCallback& callback) const { | 2511 const GetAudioOutputControllersCallback& callback) const { |
2516 audio_renderer_host()->GetOutputControllers(callback); | 2512 audio_renderer_host()->GetOutputControllers(callback); |
2517 } | 2513 } |
2518 | 2514 |
2519 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { | 2515 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { |
2520 return bluetooth_dispatcher_host_.get(); | 2516 return bluetooth_dispatcher_host_.get(); |
2521 } | 2517 } |
2522 | 2518 |
2523 } // namespace content | 2519 } // namespace content |
OLD | NEW |