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

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: Fix cache control headers Created 5 years, 9 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
« no previous file with comments | « chrome/browser/profiles/profile_impl_io_data.h ('k') | chrome/common/chrome_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 493555670f3c424a3b6d1f4723b2a4b7eb53ba6b..3add9ee8417a4e8da98e5e3cd667947cc6cb5eb0 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"
@@ -85,6 +89,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;
@@ -423,6 +441,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);
+
net::URLRequestContext* main_context = main_request_context();
IOThread* const io_thread = profile_params->io_thread;
@@ -611,6 +639,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.
« no previous file with comments | « chrome/browser/profiles/profile_impl_io_data.h ('k') | chrome/common/chrome_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698