From 6ae8d465f961bb3c6fa9ed285d877710fb69ae12 Mon Sep 17 00:00:00 2001 From: cmumford Date: Thu, 24 Mar 2016 13:35:27 -0700 Subject: Extensions: Using common ValueStoreFactory for all value stores. 1. Introduce new ValueStoreFactory interface used for the creation of ValueStore's in all namespaces (local, sync, and managed), and for all types (extension and application). 2. Delete SettingsStorageFactory/LeveldbSettingsStorageFactory, and switched to ValueStoreFactory. 3. Created a new TestValueStoreFactory (for testing). This combines settings_sync_unittest.cc:TestingValueStoreFactory and ScopedSettingsStorageFactory. 4. ValueStoreFrontend::Backend always lazilily initializes using the ValueStoreFactory. This makes unnecessary StateStore's deferred initialization mechanism - which will be removed in an upcoming CL. 5. A new ValueStoreFactoryImpl to mint new ValueStore's for Chrome. This currently delegates to a new LegacyValueStoreFactory which creates new LeveldbValueStore. An upcoming CL will add a second delegated factory (currently called ProfileValueStoreFactory) to support a unified (per-profile) extensions database. 6. Removed memcheck suppression for SettingsStorageFactory as this class is now deleted (crbug.com/163922). BUG=453946,163922 Review URL: https://codereview.chromium.org/1803193002 Cr-Commit-Position: refs/heads/master@{#383137} --- extensions/shell/browser/shell_extension_system.cc | 9 ++++++++- extensions/shell/browser/shell_extension_system.h | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'extensions/shell') diff --git a/extensions/shell/browser/shell_extension_system.cc b/extensions/shell/browser/shell_extension_system.cc index 2ed9d7b..3fbbf14 100644 --- a/extensions/shell/browser/shell_extension_system.cc +++ b/extensions/shell/browser/shell_extension_system.cc @@ -22,6 +22,7 @@ #include "extensions/browser/quota_service.h" #include "extensions/browser/runtime_data.h" #include "extensions/browser/service_worker_manager.h" +#include "extensions/browser/value_store/value_store_factory_impl.h" #include "extensions/common/constants.h" #include "extensions/common/file_util.h" @@ -31,7 +32,9 @@ using content::BrowserThread; namespace extensions { ShellExtensionSystem::ShellExtensionSystem(BrowserContext* browser_context) - : browser_context_(browser_context), weak_factory_(this) {} + : browser_context_(browser_context), + store_factory_(new ValueStoreFactoryImpl(browser_context->GetPath())), + weak_factory_(this) {} ShellExtensionSystem::~ShellExtensionSystem() { } @@ -134,6 +137,10 @@ StateStore* ShellExtensionSystem::rules_store() { return nullptr; } +scoped_refptr ShellExtensionSystem::store_factory() { + return store_factory_; +} + InfoMap* ShellExtensionSystem::info_map() { if (!info_map_.get()) info_map_ = new InfoMap; diff --git a/extensions/shell/browser/shell_extension_system.h b/extensions/shell/browser/shell_extension_system.h index b84c3fd..4448fb9 100644 --- a/extensions/shell/browser/shell_extension_system.h +++ b/extensions/shell/browser/shell_extension_system.h @@ -23,6 +23,8 @@ class BrowserContext; namespace extensions { +class ValueStoreFactory; + // A simplified version of ExtensionSystem for app_shell. Allows // app_shell to skip initialization of services it doesn't need. class ShellExtensionSystem : public ExtensionSystem { @@ -52,6 +54,7 @@ class ShellExtensionSystem : public ExtensionSystem { SharedUserScriptMaster* shared_user_script_master() override; StateStore* state_store() override; StateStore* rules_store() override; + scoped_refptr store_factory() override; InfoMap* info_map() override; QuotaService* quota_service() override; AppSorting* app_sorting() override; @@ -81,6 +84,8 @@ class ShellExtensionSystem : public ExtensionSystem { scoped_ptr quota_service_; scoped_ptr app_sorting_; + scoped_refptr store_factory_; + // Signaled when the extension system has completed its startup tasks. OneShotEvent ready_; -- cgit v1.1