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

Unified Diff: components/keyed_service/content/browser_context_keyed_service_factory.cc

Issue 2749823002: Restore KeyedServiceFactory diagnostics for context use-after-destroy. (Closed)
Patch Set: Refactor SiteEngagementService tests. Created 3 years, 9 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: components/keyed_service/content/browser_context_keyed_service_factory.cc
diff --git a/components/keyed_service/content/browser_context_keyed_service_factory.cc b/components/keyed_service/content/browser_context_keyed_service_factory.cc
index f008d176167e344e8023d87629c72b957b2d2c80..38f6ca6158a4314adcaaa3cef11387b6cae12993 100644
--- a/components/keyed_service/content/browser_context_keyed_service_factory.cc
+++ b/components/keyed_service/content/browser_context_keyed_service_factory.cc
@@ -48,12 +48,9 @@ KeyedService* BrowserContextKeyedServiceFactory::GetServiceForBrowserContext(
content::BrowserContext*
BrowserContextKeyedServiceFactory::GetBrowserContextToUse(
content::BrowserContext* context) const {
+ // TODO(crbug.com/701326): This DCHECK should be moved to GetContextToUse().
DCHECK(CalledOnValidThread());
-#ifndef NDEBUG
- AssertContextWasntDestroyed(context);
-#endif
-
// Safe default for Incognito mode: no service.
if (context->IsOffTheRecord())
return nullptr;
@@ -102,6 +99,7 @@ bool BrowserContextKeyedServiceFactory::IsOffTheRecord(
base::SupportsUserData* BrowserContextKeyedServiceFactory::GetContextToUse(
base::SupportsUserData* context) const {
+ AssertContextWasntDestroyed(context);
return GetBrowserContextToUse(static_cast<content::BrowserContext*>(context));
}

Powered by Google App Engine
This is Rietveld 408576698