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

Unified Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 881413003: Make SDCH dictionaries persistent across browser restart. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporated Matt's suggestion and removed SdchDictionaryFetcher::Data. Created 5 years, 10 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/profiles/profile_impl_io_data.cc
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc
index 5af118651a2aaa4c21d25a03237586d558a741d4..7dc0bd5b6728dd804f97a1948e573cf056bb9628 100644
--- a/chrome/browser/profiles/profile_impl_io_data.cc
+++ b/chrome/browser/profiles/profile_impl_io_data.cc
@@ -4,11 +4,15 @@
#include "chrome/browser/profiles/profile_impl_io_data.h"
+#include <set>
+
#include "base/bind.h"
#include "base/command_line.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/metrics/field_trial.h"
+#include "base/prefs/json_pref_store.h"
+#include "base/prefs/pref_filter.h"
#include "base/prefs/pref_member.h"
#include "base/prefs/pref_service.h"
#include "base/profiler/scoped_tracker.h"
@@ -424,6 +428,21 @@ void ProfileImplIOData::InitializeInternal(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"436671 ProfileImplIOData::InitializeInternal"));
+ // Confirm that there aren't duplicate preference names used by different
+ // services within the network stack.
+ std::set<std::string> preference_names;
+ DCHECK(preference_names.insert(net::SdchOwner::PreferenceName()).second);
mmenke 2015/02/04 21:14:39 DCHECKs with side effects just seem like a bad ide
Randy Smith (Not in Mondays) 2015/02/04 21:20:24 Well, given that if the DCHECK is compiled out, th
mmenke 2015/02/04 21:34:32 Only one reason. Suppose people see what you're d
Bernhard Bauer 2015/02/04 21:48:00 The difference is that a PrefService requires a pr
+
+ // Set up a persistent store for use by the network stack on the IO thread.
+ base::FilePath network_json_store_filepath(
+ profile_path_.Append(chrome::kNetworkPersistentStateFilename));
+ network_json_store_ = new JsonPrefStore(
+ network_json_store_filepath,
+ JsonPrefStore::GetTaskRunnerForFile(network_json_store_filepath,
+ BrowserThread::GetBlockingPool()),
+ scoped_ptr<PrefFilter>());
+ network_json_store_->ReadPrefsAsync(nullptr);
+
net::URLRequestContext* main_context = main_request_context();
IOThread* const io_thread = profile_params->io_thread;
@@ -611,6 +630,7 @@ void ProfileImplIOData::InitializeInternal(
sdch_manager_.reset(new net::SdchManager);
sdch_policy_.reset(new net::SdchOwner(sdch_manager_.get(), main_context));
main_context->set_sdch_manager(sdch_manager_.get());
+ sdch_policy_->EnablePersistentStorage(network_json_store_.get());
// Create a media request context based on the main context, but using a
// media cache. It shares the same job factory as the main context.

Powered by Google App Engine
This is Rietveld 408576698