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

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: Beef up SdchDictionaryFetcher tests 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..835f8f88fdfb9a7a235b327f587e03fe4910e71a 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"
@@ -90,6 +94,20 @@ net::BackendType ChooseCacheBackendType() {
#endif
}
+bool ShouldUseSdchPersistence() {
+ const std::string group =
+ base::FieldTrialList::FindFullName("SdchPersistence");
+ const base::CommandLine* command_line =
+ base::CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kEnableSdchPersistence)) {
+ return true;
+ }
+ if (command_line->HasSwitch(switches::kDisableSdchPersistence)) {
+ return false;
+ }
+ return group == "Enabled";
+}
+
} // namespace
using content::BrowserThread;
@@ -424,6 +442,16 @@ void ProfileImplIOData::InitializeInternal(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"436671 ProfileImplIOData::InitializeInternal"));
+ // 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);
Randy Smith (Not in Mondays) 2015/02/23 21:23:49 Given that there's concern around the costs of thi
Elly Fong-Jones 2015/03/03 21:37:44 Talked about this offline and decided not to do it
+
net::URLRequestContext* main_context = main_request_context();
IOThread* const io_thread = profile_params->io_thread;
@@ -612,6 +640,9 @@ 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());
+ if (ShouldUseSdchPersistence()) {
+ 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