| Index: chrome/browser/extensions/api/storage/managed_value_store_cache.cc
|
| diff --git a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
|
| index 3ac578b222dd4add17c53d8f0cef49d4a26c74bd..506a8e59ff2bbe7a8d26689b016c6be7abb653fd 100644
|
| --- a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
|
| +++ b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
|
| @@ -26,6 +26,7 @@
|
| #include "components/policy/core/common/schema_map.h"
|
| #include "components/policy/core/common/schema_registry.h"
|
| #include "content/public/browser/browser_thread.h"
|
| +#include "extensions/browser/api/storage/backend_task_runner.h"
|
| #include "extensions/browser/extension_prefs.h"
|
| #include "extensions/browser/extension_registry.h"
|
| #include "extensions/browser/extension_registry_observer.h"
|
| @@ -259,7 +260,7 @@ ManagedValueStoreCache::ManagedValueStoreCache(
|
| }
|
|
|
| ManagedValueStoreCache::~ManagedValueStoreCache() {
|
| - DCHECK_CURRENTLY_ON(BrowserThread::FILE);
|
| + DCHECK(IsOnBackendSequence());
|
| // Delete the PolicyValueStores on FILE.
|
| store_map_.clear();
|
| }
|
| @@ -273,13 +274,13 @@ void ManagedValueStoreCache::ShutdownOnUI() {
|
| void ManagedValueStoreCache::RunWithValueStoreForExtension(
|
| const StorageCallback& callback,
|
| scoped_refptr<const Extension> extension) {
|
| - DCHECK_CURRENTLY_ON(BrowserThread::FILE);
|
| + DCHECK(IsOnBackendSequence());
|
| callback.Run(GetStoreFor(extension->id()));
|
| }
|
|
|
| void ManagedValueStoreCache::DeleteStorageSoon(
|
| const std::string& extension_id) {
|
| - DCHECK_CURRENTLY_ON(BrowserThread::FILE);
|
| + DCHECK(IsOnBackendSequence());
|
| // It's possible that the store exists, but hasn't been loaded yet
|
| // (because the extension is unloaded, for example). Open the database to
|
| // clear it if it exists.
|
| @@ -327,11 +328,10 @@ void ManagedValueStoreCache::OnPolicyUpdated(const policy::PolicyNamespace& ns,
|
| return;
|
| }
|
|
|
| - BrowserThread::PostTask(
|
| - BrowserThread::FILE, FROM_HERE,
|
| - base::BindOnce(&ManagedValueStoreCache::UpdatePolicyOnFILE,
|
| - base::Unretained(this), ns.component_id,
|
| - base::Passed(current.DeepCopy())));
|
| + GetBackendTaskRunner()->PostTask(
|
| + FROM_HERE, base::BindOnce(&ManagedValueStoreCache::UpdatePolicyOnBackend,
|
| + base::Unretained(this), ns.component_id,
|
| + base::Passed(current.DeepCopy())));
|
| }
|
|
|
| // static
|
| @@ -345,10 +345,10 @@ policy::PolicyDomain ManagedValueStoreCache::GetPolicyDomain(Profile* profile) {
|
| #endif
|
| }
|
|
|
| -void ManagedValueStoreCache::UpdatePolicyOnFILE(
|
| +void ManagedValueStoreCache::UpdatePolicyOnBackend(
|
| const std::string& extension_id,
|
| std::unique_ptr<policy::PolicyMap> current_policy) {
|
| - DCHECK_CURRENTLY_ON(BrowserThread::FILE);
|
| + DCHECK(IsOnBackendSequence());
|
|
|
| if (!HasStore(extension_id) && current_policy->empty()) {
|
| // Don't create the store now if there are no policies configured for this
|
| @@ -362,7 +362,7 @@ void ManagedValueStoreCache::UpdatePolicyOnFILE(
|
|
|
| PolicyValueStore* ManagedValueStoreCache::GetStoreFor(
|
| const std::string& extension_id) {
|
| - DCHECK_CURRENTLY_ON(BrowserThread::FILE);
|
| + DCHECK(IsOnBackendSequence());
|
|
|
| auto it = store_map_.find(extension_id);
|
| if (it != store_map_.end())
|
|
|