OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "content/browser/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 render_widget_host_ = new RenderWidgetHostImpl(rwh_delegate, GetProcess(), | 264 render_widget_host_ = new RenderWidgetHostImpl(rwh_delegate, GetProcess(), |
265 widget_routing_id, hidden); | 265 widget_routing_id, hidden); |
266 render_widget_host_->set_owned_by_render_frame_host(true); | 266 render_widget_host_->set_owned_by_render_frame_host(true); |
267 } else { | 267 } else { |
268 DCHECK(!render_widget_host_->owned_by_render_frame_host()); | 268 DCHECK(!render_widget_host_->owned_by_render_frame_host()); |
269 } | 269 } |
270 InputRouterImpl* ir = | 270 InputRouterImpl* ir = |
271 static_cast<InputRouterImpl*>(render_widget_host_->input_router()); | 271 static_cast<InputRouterImpl*>(render_widget_host_->input_router()); |
272 ir->SetFrameTreeNodeId(frame_tree_node_->frame_tree_node_id()); | 272 ir->SetFrameTreeNodeId(frame_tree_node_->frame_tree_node_id()); |
273 } | 273 } |
| 274 audio_output_impl_ = 0; |
274 } | 275 } |
275 | 276 |
276 RenderFrameHostImpl::~RenderFrameHostImpl() { | 277 RenderFrameHostImpl::~RenderFrameHostImpl() { |
277 // Release the WebUI instances before all else as the WebUI may accesses the | 278 // Release the WebUI instances before all else as the WebUI may accesses the |
278 // RenderFrameHost during cleanup. | 279 // RenderFrameHost during cleanup. |
279 ClearAllWebUI(); | 280 ClearAllWebUI(); |
280 | 281 |
281 GetProcess()->RemoveRoute(routing_id_); | 282 GetProcess()->RemoveRoute(routing_id_); |
282 g_routing_id_frame_map.Get().erase( | 283 g_routing_id_frame_map.Get().erase( |
283 RenderFrameHostID(GetProcess()->GetID(), routing_id_)); | 284 RenderFrameHostID(GetProcess()->GetID(), routing_id_)); |
(...skipping 25 matching lines...) Expand all Loading... |
309 | 310 |
310 if (render_widget_host_ && | 311 if (render_widget_host_ && |
311 render_widget_host_->owned_by_render_frame_host()) { | 312 render_widget_host_->owned_by_render_frame_host()) { |
312 // Shutdown causes the RenderWidgetHost to delete itself. | 313 // Shutdown causes the RenderWidgetHost to delete itself. |
313 render_widget_host_->ShutdownAndDestroyWidget(true); | 314 render_widget_host_->ShutdownAndDestroyWidget(true); |
314 } | 315 } |
315 | 316 |
316 // Notify the FrameTree that this RFH is going away, allowing it to shut down | 317 // Notify the FrameTree that this RFH is going away, allowing it to shut down |
317 // the corresponding RenderViewHost if it is no longer needed. | 318 // the corresponding RenderViewHost if it is no longer needed. |
318 frame_tree_->ReleaseRenderViewHostRef(render_view_host_); | 319 frame_tree_->ReleaseRenderViewHostRef(render_view_host_); |
| 320 if (audio_output_impl_) { |
| 321 audio_output_impl_->Reset(); |
| 322 } |
319 } | 323 } |
320 | 324 |
321 int RenderFrameHostImpl::GetRoutingID() { | 325 int RenderFrameHostImpl::GetRoutingID() { |
322 return routing_id_; | 326 return routing_id_; |
323 } | 327 } |
324 | 328 |
325 AXTreeIDRegistry::AXTreeID RenderFrameHostImpl::GetAXTreeID() { | 329 AXTreeIDRegistry::AXTreeID RenderFrameHostImpl::GetAXTreeID() { |
326 return AXTreeIDRegistry::GetInstance()->GetOrCreateAXTreeID( | 330 return AXTreeIDRegistry::GetInstance()->GetOrCreateAXTreeID( |
327 GetProcess()->GetID(), routing_id_); | 331 GetProcess()->GetID(), routing_id_); |
328 } | 332 } |
(...skipping 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2006 base::Bind(&RenderFrameHostImpl::CreateWebBluetoothService, | 2010 base::Bind(&RenderFrameHostImpl::CreateWebBluetoothService, |
2007 base::Unretained(this))); | 2011 base::Unretained(this))); |
2008 } | 2012 } |
2009 | 2013 |
2010 if (!frame_mojo_shell_) | 2014 if (!frame_mojo_shell_) |
2011 frame_mojo_shell_.reset(new FrameMojoShell(this)); | 2015 frame_mojo_shell_.reset(new FrameMojoShell(this)); |
2012 | 2016 |
2013 GetServiceRegistry()->AddService<shell::mojom::Connector>(base::Bind( | 2017 GetServiceRegistry()->AddService<shell::mojom::Connector>(base::Bind( |
2014 &FrameMojoShell::BindRequest, base::Unretained(frame_mojo_shell_.get()))); | 2018 &FrameMojoShell::BindRequest, base::Unretained(frame_mojo_shell_.get()))); |
2015 | 2019 |
| 2020 GetServiceRegistry()->AddService( |
| 2021 base::Bind(&AudioOutputImpl::CreateService, this)); |
| 2022 |
2016 #if defined(ENABLE_WEBVR) | 2023 #if defined(ENABLE_WEBVR) |
2017 const base::CommandLine& browser_command_line = | 2024 const base::CommandLine& browser_command_line = |
2018 *base::CommandLine::ForCurrentProcess(); | 2025 *base::CommandLine::ForCurrentProcess(); |
2019 | 2026 |
2020 if (browser_command_line.HasSwitch(switches::kEnableWebVR)) { | 2027 if (browser_command_line.HasSwitch(switches::kEnableWebVR)) { |
2021 GetServiceRegistry()->AddService<blink::mojom::VRService>( | 2028 GetServiceRegistry()->AddService<blink::mojom::VRService>( |
2022 base::Bind(&VRDeviceManager::BindRequest)); | 2029 base::Bind(&VRDeviceManager::BindRequest)); |
2023 } | 2030 } |
2024 #endif | 2031 #endif |
2025 | 2032 |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2849 // handler after it's destroyed so it can't run after the RFHI is destroyed. | 2856 // handler after it's destroyed so it can't run after the RFHI is destroyed. |
2850 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 2857 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
2851 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 2858 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
2852 } | 2859 } |
2853 | 2860 |
2854 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 2861 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
2855 web_bluetooth_service_.reset(); | 2862 web_bluetooth_service_.reset(); |
2856 } | 2863 } |
2857 | 2864 |
2858 } // namespace content | 2865 } // namespace content |
OLD | NEW |