Commit 99183d7a authored by Derek Schuff's avatar Derek Schuff Committed by Commit Bot

Revert "Add DCHECKs for correct thread usage of KeyedService code"

This reverts commit 382570ad.

Reason for revert: https://bugs.chromium.org/p/chromium/issues/detail?id=996603#c1

Original change's description:
> Add DCHECKs for correct thread usage of KeyedService code
> 
> Bug: 701326
> Change-Id: If652eb76fabc09cabdd61865cdb409f72c140392
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1748083
> Reviewed-by: Lutz Justen <ljusten@chromium.org>
> Reviewed-by: Cait Phillips <caitkp@chromium.org>
> Commit-Queue: Derek Schuff <dschuff@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#686622}

TBR=dschuff@chromium.org,caitkp@chromium.org,blundell@chromium.org,ljusten@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 701326
Change-Id: Ibc4ea2793a1cc0cf97b268fb6bf902791023c365
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1765499Reviewed-by: default avatarDerek Schuff <dschuff@chromium.org>
Commit-Queue: Derek Schuff <dschuff@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689727}
parent 7211b43b
......@@ -60,6 +60,9 @@ KeyedService* BrowserContextKeyedServiceFactory::GetServiceForBrowserContext(
content::BrowserContext*
BrowserContextKeyedServiceFactory::GetBrowserContextToUse(
content::BrowserContext* context) const {
// TODO(crbug.com/701326): This DCHECK should be moved to GetContextToUse().
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// Safe default for Incognito mode: no service.
if (context->IsOffTheRecord())
return nullptr;
......@@ -100,7 +103,6 @@ bool BrowserContextKeyedServiceFactory::IsOffTheRecord(void* context) const {
}
void* BrowserContextKeyedServiceFactory::GetContextToUse(void* context) const {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
AssertContextWasntDestroyed(context);
return GetBrowserContextToUse(static_cast<content::BrowserContext*>(context));
}
......
......@@ -61,6 +61,9 @@ RefcountedBrowserContextKeyedServiceFactory::GetServiceForBrowserContext(
content::BrowserContext*
RefcountedBrowserContextKeyedServiceFactory::GetBrowserContextToUse(
content::BrowserContext* context) const {
// TODO(crbug.com/701326): This DCHECK should be moved to GetContextToUse().
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// Safe default for Incognito mode: no service.
if (context->IsOffTheRecord())
return nullptr;
......@@ -102,7 +105,6 @@ bool RefcountedBrowserContextKeyedServiceFactory::IsOffTheRecord(
void* RefcountedBrowserContextKeyedServiceFactory::GetContextToUse(
void* context) const {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
AssertContextWasntDestroyed(context);
return GetBrowserContextToUse(static_cast<content::BrowserContext*>(context));
}
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -35,7 +34,9 @@ void KeyedServiceBaseFactory::DependsOn(KeyedServiceBaseFactory* rhs) {
}
void KeyedServiceBaseFactory::AssertContextWasntDestroyed(void* context) const {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// TODO(crbug.com/701326): We should DCHECK(CalledOnValidThread()) here, but
// currently some code doesn't do service getting on the main thread.
// This needs to be fixed and DCHECK should be restored here.
dependency_manager_->AssertContextWasntDestroyed(context);
}
......
......@@ -54,6 +54,9 @@ KeyedService* BrowserStateKeyedServiceFactory::GetServiceForBrowserState(
web::BrowserState* BrowserStateKeyedServiceFactory::GetBrowserStateToUse(
web::BrowserState* context) const {
// TODO(crbug.com/701326): This DCHECK should be moved to GetContextToUse().
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// Safe default for Incognito mode: no service.
if (context->IsOffTheRecord())
return nullptr;
......@@ -89,7 +92,6 @@ bool BrowserStateKeyedServiceFactory::IsOffTheRecord(void* context) const {
}
void* BrowserStateKeyedServiceFactory::GetContextToUse(void* context) const {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
AssertContextWasntDestroyed(context);
return GetBrowserStateToUse(static_cast<web::BrowserState*>(context));
}
......
......@@ -60,6 +60,9 @@ RefcountedBrowserStateKeyedServiceFactory::GetServiceForBrowserState(
web::BrowserState*
RefcountedBrowserStateKeyedServiceFactory::GetBrowserStateToUse(
web::BrowserState* context) const {
// TODO(crbug.com/701326): This DCHECK should be moved to GetContextToUse().
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// Safe default for Incognito mode: no service.
if (context->IsOffTheRecord())
return nullptr;
......@@ -100,7 +103,6 @@ bool RefcountedBrowserStateKeyedServiceFactory::IsOffTheRecord(
void* RefcountedBrowserStateKeyedServiceFactory::GetContextToUse(
void* context) const {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
AssertContextWasntDestroyed(context);
return GetBrowserStateToUse(static_cast<web::BrowserState*>(context));
}
......
......@@ -120,5 +120,7 @@ KeyedService* PolicyBlacklistFactory::BuildServiceInstanceFor(
content::BrowserContext* PolicyBlacklistFactory::GetBrowserContextToUse(
content::BrowserContext* context) const {
// TODO(crbug.com/701326): This DCHECK should be moved to GetContextToUse().
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return context;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment