Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Unified Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 1459343003: Have GeolocationServiceImpl refer to RFHI via a weak pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/render_frame_host_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 9a8810b3aa9a45c2ec8424f30fbbff6800fe5421..edddbc940f08e5f7552b5126d1f7891588a92449 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -1696,11 +1696,17 @@ void RenderFrameHostImpl::RegisterMojoServices() {
// TODO(creis): Bind process ID here so that GeolocationServiceImpl
// can perform permissions checks once site isolation is complete.
// crbug.com/426384
+ // NOTE: At shutdown, there is no guaranteed ordering between destruction of
+ // this object and destruction of any GeolocationServicesImpls created via
+ // the below service registry, the reason being that the destruction of the
+ // latter is triggered by receiving a message that the pipe was closed from
+ // the renderer side. Hence, supply the reference to this object as a weak
+ // 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
GetServiceRegistry()->AddService<GeolocationService>(
base::Bind(&GeolocationServiceContext::CreateService,
base::Unretained(geolocation_service_context),
base::Bind(&RenderFrameHostImpl::DidUseGeolocationPermission,
- base::Unretained(this))));
+ 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.
}
WakeLockServiceContext* wake_lock_service_context =
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698