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

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

Issue 901303002: Make SDCH dictionaries persistent across browser restart. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 e2cb0ec4ef3e10a0c01acdce32227b3e2d5591a7..4e1e60152e5716ca11ac19d3dcc10b9cf2e77eb6 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);
Bernhard Bauer 2015/02/06 16:40:27 AFAIU the discussion on the previous CL, the conse
Elly Fong-Jones 2015/02/06 18:44:09 Done.
+
+ // 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;
@@ -612,6 +631,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