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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1689 } | 1689 } |
1690 #endif | 1690 #endif |
1691 | 1691 |
1692 void RenderFrameHostImpl::RegisterMojoServices() { | 1692 void RenderFrameHostImpl::RegisterMojoServices() { |
1693 GeolocationServiceContext* geolocation_service_context = | 1693 GeolocationServiceContext* geolocation_service_context = |
1694 delegate_ ? delegate_->GetGeolocationServiceContext() : NULL; | 1694 delegate_ ? delegate_->GetGeolocationServiceContext() : NULL; |
1695 if (geolocation_service_context) { | 1695 if (geolocation_service_context) { |
1696 // TODO(creis): Bind process ID here so that GeolocationServiceImpl | 1696 // TODO(creis): Bind process ID here so that GeolocationServiceImpl |
1697 // can perform permissions checks once site isolation is complete. | 1697 // can perform permissions checks once site isolation is complete. |
1698 // crbug.com/426384 | 1698 // crbug.com/426384 |
1699 // NOTE: At shutdown, there is no guaranteed ordering between destruction of | |
1700 // this object and destruction of any GeolocationServicesImpls created via | |
1701 // the below service registry, the reason being that the destruction of the | |
1702 // latter is triggered by receiving a message that the pipe was closed from | |
1703 // the renderer side. Hence, supply the reference to this object as a weak | |
1704 // pointer. | |
Michael van Ouwerkerk
2016/02/18 09:37:57
Nit: maybe also refer to crbug.com/556749 in this
blundell
2016/02/26 12:34:12
I think the comment is sufficient to explain the i
| |
1699 GetServiceRegistry()->AddService<GeolocationService>( | 1705 GetServiceRegistry()->AddService<GeolocationService>( |
1700 base::Bind(&GeolocationServiceContext::CreateService, | 1706 base::Bind(&GeolocationServiceContext::CreateService, |
1701 base::Unretained(geolocation_service_context), | 1707 base::Unretained(geolocation_service_context), |
1702 base::Bind(&RenderFrameHostImpl::DidUseGeolocationPermission, | 1708 base::Bind(&RenderFrameHostImpl::DidUseGeolocationPermission, |
1703 base::Unretained(this)))); | 1709 weak_ptr_factory_.GetWeakPtr()))); |
ncarter (slow)
2016/02/19 00:44:36
The RenderFrameHostImpl owns the ServiceRegistry,
ncarter (slow)
2016/02/19 23:09:44
I looked at this a little more, and am inferring t
blundell
2016/02/26 12:32:50
Correct.
| |
1704 } | 1710 } |
1705 | 1711 |
1706 WakeLockServiceContext* wake_lock_service_context = | 1712 WakeLockServiceContext* wake_lock_service_context = |
1707 delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr; | 1713 delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr; |
1708 if (wake_lock_service_context) { | 1714 if (wake_lock_service_context) { |
1709 // WakeLockServiceContext is owned by WebContentsImpl so it will outlive | 1715 // WakeLockServiceContext is owned by WebContentsImpl so it will outlive |
1710 // this RenderFrameHostImpl, hence a raw pointer can be bound to service | 1716 // this RenderFrameHostImpl, hence a raw pointer can be bound to service |
1711 // factory callback. | 1717 // factory callback. |
1712 GetServiceRegistry()->AddService<WakeLockService>( | 1718 GetServiceRegistry()->AddService<WakeLockService>( |
1713 base::Bind(&WakeLockServiceContext::CreateService, | 1719 base::Bind(&WakeLockServiceContext::CreateService, |
1714 base::Unretained(wake_lock_service_context), | 1720 base::Unretained(wake_lock_service_context), |
1715 GetProcess()->GetID(), GetRoutingID())); | 1721 GetProcess()->GetID(), GetRoutingID())); |
1716 } | 1722 } |
1717 | 1723 |
1718 if (!permission_service_context_) | 1724 if (!permission_service_context_) |
1719 permission_service_context_.reset(new PermissionServiceContext(this)); | 1725 permission_service_context_.reset(new PermissionServiceContext(this)); |
1720 | 1726 |
1721 GetServiceRegistry()->AddService<PermissionService>( | 1727 GetServiceRegistry()->AddService<PermissionService>( |
1722 base::Bind(&PermissionServiceContext::CreateService, | 1728 base::Bind(&PermissionServiceContext::CreateService, |
1723 base::Unretained(permission_service_context_.get()))); | 1729 base::Unretained(permission_service_context_.get()))); |
1724 | 1730 |
1725 GetServiceRegistry()->AddService<presentation::PresentationService>( | 1731 GetServiceRegistry()->AddService<presentation::PresentationService>( |
1726 base::Bind(&PresentationServiceImpl::CreateMojoService, | 1732 base::Bind(&PresentationServiceImpl::CreateMojoService, |
1727 base::Unretained(this))); | 1733 base::Unretained(this))); |
Charlie Reis
2016/02/18 22:51:16
Won't this be a problem for all of these Mojo serv
Charlie Reis
2016/02/25 21:00:57
Ok, Nick explained that these other services shoul
blundell
2016/02/26 12:32:50
Good catch on pointing out the other cases here th
| |
1728 | 1734 |
1729 if (!frame_mojo_shell_) | 1735 if (!frame_mojo_shell_) |
1730 frame_mojo_shell_.reset(new FrameMojoShell(this)); | 1736 frame_mojo_shell_.reset(new FrameMojoShell(this)); |
1731 | 1737 |
1732 GetServiceRegistry()->AddService<mojo::Shell>(base::Bind( | 1738 GetServiceRegistry()->AddService<mojo::Shell>(base::Bind( |
1733 &FrameMojoShell::BindRequest, base::Unretained(frame_mojo_shell_.get()))); | 1739 &FrameMojoShell::BindRequest, base::Unretained(frame_mojo_shell_.get()))); |
1734 | 1740 |
1735 #if defined(ENABLE_WEBVR) | 1741 #if defined(ENABLE_WEBVR) |
1736 const base::CommandLine& browser_command_line = | 1742 const base::CommandLine& browser_command_line = |
1737 *base::CommandLine::ForCurrentProcess(); | 1743 *base::CommandLine::ForCurrentProcess(); |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2378 *dst = src; | 2384 *dst = src; |
2379 | 2385 |
2380 if (src.routing_id != -1) | 2386 if (src.routing_id != -1) |
2381 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); | 2387 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); |
2382 | 2388 |
2383 if (src.parent_routing_id != -1) | 2389 if (src.parent_routing_id != -1) |
2384 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); | 2390 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); |
2385 } | 2391 } |
2386 | 2392 |
2387 } // namespace content | 2393 } // namespace content |
OLD | NEW |