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

Unified Diff: chrome/browser/prefs/profile_pref_store_manager.cc

Issue 329093003: Remove unloaded profile hash store initialization, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove more code. Created 6 years, 6 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/prefs/profile_pref_store_manager.cc
diff --git a/chrome/browser/prefs/profile_pref_store_manager.cc b/chrome/browser/prefs/profile_pref_store_manager.cc
index d5a64b05a4b8502064d0d1d536fce315db014b7f..592b0f9ffa1041e8dd42caa4feb8fc8f2e465b02 100644
--- a/chrome/browser/prefs/profile_pref_store_manager.cc
+++ b/chrome/browser/prefs/profile_pref_store_manager.cc
@@ -35,9 +35,6 @@ class DictionaryHashStoreContents : public HashStoreContents {
super_mac_(to_copy.GetSuperMac()) {
if (to_copy.IsInitialized())
dictionary_.reset(to_copy.GetContents()->DeepCopy());
- int version = 0;
- if (to_copy.GetVersion(&version))
- version_.reset(new int(version));
}
// HashStoreContents implementation
@@ -46,7 +43,6 @@ class DictionaryHashStoreContents : public HashStoreContents {
virtual void Reset() OVERRIDE {
dictionary_.reset();
super_mac_.clear();
- version_.reset();
}
virtual bool IsInitialized() const OVERRIDE {
@@ -68,17 +64,6 @@ class DictionaryHashStoreContents : public HashStoreContents {
super_mac_ = super_mac;
}
- virtual bool GetVersion(int* version) const OVERRIDE {
- if (!version_)
- return false;
- *version = *version_;
- return true;
- }
-
- virtual void SetVersion(int version) OVERRIDE {
- version_.reset(new int(version));
- }
-
virtual void CommitPendingWrite() OVERRIDE {}
private:
@@ -105,7 +90,6 @@ class DictionaryHashStoreContents : public HashStoreContents {
const std::string hash_store_id_;
std::string super_mac_;
- scoped_ptr<int> version_;
scoped_ptr<base::DictionaryValue> dictionary_;
DISALLOW_COPY_AND_ASSIGN(DictionaryHashStoreContents);
@@ -136,63 +120,6 @@ class DictionaryPrefStore : public PrefStore {
DISALLOW_COPY_AND_ASSIGN(DictionaryPrefStore);
};
-// Waits for a PrefStore to be initialized and then initializes the
-// corresponding PrefHashStore.
-// The observer deletes itself when its work is completed.
-class InitializeHashStoreObserver : public PrefStore::Observer {
- public:
- // Creates an observer that will initialize |pref_hash_store| with the
- // contents of |pref_store| when the latter is fully loaded.
- InitializeHashStoreObserver(
- const std::vector<PrefHashFilter::TrackedPreferenceMetadata>&
- tracking_configuration,
- size_t reporting_ids_count,
- const scoped_refptr<PrefStore>& pref_store,
- scoped_ptr<PrefHashStoreImpl> pref_hash_store_impl)
- : tracking_configuration_(tracking_configuration),
- reporting_ids_count_(reporting_ids_count),
- pref_store_(pref_store),
- pref_hash_store_impl_(pref_hash_store_impl.Pass()) {}
-
- virtual ~InitializeHashStoreObserver();
-
- // PrefStore::Observer implementation.
- virtual void OnPrefValueChanged(const std::string& key) OVERRIDE;
- virtual void OnInitializationCompleted(bool succeeded) OVERRIDE;
-
- private:
- const std::vector<PrefHashFilter::TrackedPreferenceMetadata>
- tracking_configuration_;
- const size_t reporting_ids_count_;
- scoped_refptr<PrefStore> pref_store_;
- scoped_ptr<PrefHashStoreImpl> pref_hash_store_impl_;
-
- DISALLOW_COPY_AND_ASSIGN(InitializeHashStoreObserver);
-};
-
-InitializeHashStoreObserver::~InitializeHashStoreObserver() {}
-
-void InitializeHashStoreObserver::OnPrefValueChanged(const std::string& key) {}
-
-void InitializeHashStoreObserver::OnInitializationCompleted(bool succeeded) {
- // If we successfully loaded the preferences _and_ the PrefHashStoreImpl
- // hasn't been initialized by someone else in the meantime, initialize it now.
- const PrefHashStoreImpl::StoreVersion pre_update_version =
- pref_hash_store_impl_->GetCurrentVersion();
- if (succeeded && pre_update_version < PrefHashStoreImpl::VERSION_LATEST) {
- PrefHashFilter(pref_hash_store_impl_.PassAs<PrefHashStore>(),
- tracking_configuration_,
- NULL,
- reporting_ids_count_).Initialize(*pref_store_);
- UMA_HISTOGRAM_ENUMERATION(
- "Settings.TrackedPreferencesAlternateStoreVersionUpdatedFrom",
gab 2014/06/11 19:25:42 Mark this histogram obsolete in histograms.xml.
erikwright (departed) 2014/06/11 21:08:36 Done.
- pre_update_version,
- PrefHashStoreImpl::VERSION_LATEST + 1);
- }
- pref_store_->RemoveObserver(this);
- delete this;
-}
-
} // namespace
// TODO(erikwright): Enable this on Chrome OS and Android once MACs are moved
@@ -254,11 +181,6 @@ void ProfilePrefStoreManager::ClearResetTime(PrefService* pref_service) {
PrefHashFilter::ClearResetTime(pref_service);
}
-void ProfilePrefStoreManager::ResetPrefHashStore() {
- if (kPlatformSupportsPreferenceTracking)
- GetPrefHashStoreImpl()->Reset();
-}
-
PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore(
const scoped_refptr<base::SequencedTaskRunner>& io_task_runner,
TrackedPreferenceValidationDelegate* validation_delegate) {
@@ -331,32 +253,6 @@ PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore(
protected_pref_names);
}
-void ProfilePrefStoreManager::UpdateProfileHashStoreIfRequired(
- const scoped_refptr<base::SequencedTaskRunner>& io_task_runner) {
- if (!kPlatformSupportsPreferenceTracking)
- return;
- scoped_ptr<PrefHashStoreImpl> pref_hash_store_impl(GetPrefHashStoreImpl());
- const PrefHashStoreImpl::StoreVersion current_version =
- pref_hash_store_impl->GetCurrentVersion();
- UMA_HISTOGRAM_ENUMERATION("Settings.TrackedPreferencesAlternateStoreVersion",
gab 2014/06/11 19:25:42 Mark this histogram obsolete in histograms.xml.
erikwright (departed) 2014/06/11 21:08:36 Done.
- current_version,
- PrefHashStoreImpl::VERSION_LATEST + 1);
-
- // Update the pref hash store if it's not at the latest version.
- if (current_version != PrefHashStoreImpl::VERSION_LATEST) {
- scoped_refptr<JsonPrefStore> pref_store =
- new JsonPrefStore(GetPrefFilePathFromProfilePath(profile_path_),
- io_task_runner,
- scoped_ptr<PrefFilter>());
- pref_store->AddObserver(
- new InitializeHashStoreObserver(tracking_configuration_,
- reporting_ids_count_,
- pref_store,
- pref_hash_store_impl.Pass()));
- pref_store->ReadPrefsAsync(NULL);
- }
-}
-
bool ProfilePrefStoreManager::InitializePrefsFromMasterPrefs(
const base::DictionaryValue& master_prefs) {
// Create the profile directory if it doesn't exist yet (very possible on

Powered by Google App Engine
This is Rietveld 408576698