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

Unified Diff: chrome/browser/geolocation/chrome_geolocation_permission_context.cc

Issue 11590002: Destroy GeolocationInfobarQueueController on UI thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit. Created 7 years, 11 months 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
Index: chrome/browser/geolocation/chrome_geolocation_permission_context.cc
diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context.cc
index 12065c17cad152cc2b3513dd0c24e0430c9090bb..450adc8c07e2ff3944287d4bd18d7fe592d0406d 100644
--- a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc
+++ b/chrome/browser/geolocation/chrome_geolocation_permission_context.cc
@@ -31,10 +31,15 @@ using extensions::APIPermission;
ChromeGeolocationPermissionContext::ChromeGeolocationPermissionContext(
Profile* profile)
- : profile_(profile) {
+ : profile_(profile),
+ shutting_down_(false) {
}
ChromeGeolocationPermissionContext::~ChromeGeolocationPermissionContext() {
+ // ChromeGeolocationPermissionContext may be destroyed on either the UI thread
+ // or the IO thread, but the GeolocationInfobarQueueController must have been
+ // destroyed on the UI thread.
+ DCHECK(!geolocation_infobar_queue_controller_.get());
}
void ChromeGeolocationPermissionContext::RequestGeolocationPermission(
@@ -54,6 +59,9 @@ void ChromeGeolocationPermissionContext::RequestGeolocationPermission(
}
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ if (shutting_down_)
+ return;
+
content::WebContents* web_contents =
tab_util::GetWebContentsByID(render_process_id, render_view_id);
const GeolocationPermissionRequestID id(render_process_id, render_view_id,
@@ -100,7 +108,6 @@ void ChromeGeolocationPermissionContext::RequestGeolocationPermission(
}
DecidePermission(id, requesting_frame, embedder, callback);
-
}
void ChromeGeolocationPermissionContext::CancelGeolocationPermissionRequest(
@@ -139,6 +146,12 @@ void ChromeGeolocationPermissionContext::DecidePermission(
}
}
+void ChromeGeolocationPermissionContext::ShutdownOnUIThread() {
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ geolocation_infobar_queue_controller_.reset();
+ shutting_down_ = true;
+}
+
void ChromeGeolocationPermissionContext::PermissionDecided(
const GeolocationPermissionRequestID& id,
const GURL& requesting_frame,
@@ -170,6 +183,7 @@ void ChromeGeolocationPermissionContext::NotifyPermissionSet(
GeolocationInfoBarQueueController*
ChromeGeolocationPermissionContext::QueueController() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ DCHECK(!shutting_down_);
if (!geolocation_infobar_queue_controller_)
geolocation_infobar_queue_controller_.reset(CreateQueueController());
return geolocation_infobar_queue_controller_.get();
@@ -192,5 +206,7 @@ void ChromeGeolocationPermissionContext::CancelPendingInfoBarRequest(
return;
}
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ if (shutting_down_)
+ return;
QueueController()->CancelInfoBarRequest(id);
}

Powered by Google App Engine
This is Rietveld 408576698