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

Side by Side 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: First round of persistence 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/profiles/profile_impl_io_data.h" 5 #include "chrome/browser/profiles/profile_impl_io_data.h"
6 6
7 #include <set>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/command_line.h" 10 #include "base/command_line.h"
9 #include "base/logging.h" 11 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
11 #include "base/metrics/field_trial.h" 13 #include "base/metrics/field_trial.h"
14 #include "base/prefs/json_pref_store.h"
15 #include "base/prefs/pref_filter.h"
12 #include "base/prefs/pref_member.h" 16 #include "base/prefs/pref_member.h"
13 #include "base/prefs/pref_service.h" 17 #include "base/prefs/pref_service.h"
14 #include "base/profiler/scoped_tracker.h" 18 #include "base/profiler/scoped_tracker.h"
15 #include "base/sequenced_task_runner.h" 19 #include "base/sequenced_task_runner.h"
16 #include "base/stl_util.h" 20 #include "base/stl_util.h"
17 #include "base/strings/string_util.h" 21 #include "base/strings/string_util.h"
18 #include "base/threading/sequenced_worker_pool.h" 22 #include "base/threading/sequenced_worker_pool.h"
19 #include "base/threading/worker_pool.h" 23 #include "base/threading/worker_pool.h"
20 #include "chrome/browser/browser_process.h" 24 #include "chrome/browser/browser_process.h"
21 #include "chrome/browser/chrome_notification_types.h" 25 #include "chrome/browser/chrome_notification_types.h"
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 void ProfileImplIOData::InitializeInternal( 421 void ProfileImplIOData::InitializeInternal(
418 scoped_ptr<ChromeNetworkDelegate> chrome_network_delegate, 422 scoped_ptr<ChromeNetworkDelegate> chrome_network_delegate,
419 ProfileParams* profile_params, 423 ProfileParams* profile_params,
420 content::ProtocolHandlerMap* protocol_handlers, 424 content::ProtocolHandlerMap* protocol_handlers,
421 content::URLRequestInterceptorScopedVector request_interceptors) const { 425 content::URLRequestInterceptorScopedVector request_interceptors) const {
422 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. 426 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed.
423 tracked_objects::ScopedTracker tracking_profile( 427 tracked_objects::ScopedTracker tracking_profile(
424 FROM_HERE_WITH_EXPLICIT_FUNCTION( 428 FROM_HERE_WITH_EXPLICIT_FUNCTION(
425 "436671 ProfileImplIOData::InitializeInternal")); 429 "436671 ProfileImplIOData::InitializeInternal"));
426 430
431 // Confirm that there aren't duplicate preference names used by different
432 // services within the network stack.
433 std::set<std::string> preference_names;
434 DCHECK(preference_names.insert(net::SdchOwner::PreferenceName()).second);
435
436 // Set up a persistent store for use by the network stack on the IO thread.
437 base::FilePath network_json_store_filepath(
438 profile_path_.Append(chrome::kNetworkPersistentStateFilename));
439 network_json_store_ = new JsonPrefStore(
440 network_json_store_filepath,
441 JsonPrefStore::GetTaskRunnerForFile(network_json_store_filepath,
442 BrowserThread::GetBlockingPool()),
443 scoped_ptr<PrefFilter>());
444 network_json_store_->ReadPrefsAsync(nullptr);
445
427 net::URLRequestContext* main_context = main_request_context(); 446 net::URLRequestContext* main_context = main_request_context();
428 447
429 IOThread* const io_thread = profile_params->io_thread; 448 IOThread* const io_thread = profile_params->io_thread;
430 IOThread::Globals* const io_thread_globals = io_thread->globals(); 449 IOThread::Globals* const io_thread_globals = io_thread->globals();
431 450
432 chrome_network_delegate->set_predictor(predictor_.get()); 451 chrome_network_delegate->set_predictor(predictor_.get());
433 452
434 if (domain_reliability_monitor_) { 453 if (domain_reliability_monitor_) {
435 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. 454 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed.
436 tracked_objects::ScopedTracker tracking_profile1( 455 tracked_objects::ScopedTracker tracking_profile1(
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 "436671 ProfileImplIOData::InitializeInternal9")); 623 "436671 ProfileImplIOData::InitializeInternal9"));
605 624
606 #if defined(ENABLE_EXTENSIONS) 625 #if defined(ENABLE_EXTENSIONS)
607 InitializeExtensionsRequestContext(profile_params); 626 InitializeExtensionsRequestContext(profile_params);
608 #endif 627 #endif
609 628
610 // Setup SDCH for this profile. 629 // Setup SDCH for this profile.
611 sdch_manager_.reset(new net::SdchManager); 630 sdch_manager_.reset(new net::SdchManager);
612 sdch_policy_.reset(new net::SdchOwner(sdch_manager_.get(), main_context)); 631 sdch_policy_.reset(new net::SdchOwner(sdch_manager_.get(), main_context));
613 main_context->set_sdch_manager(sdch_manager_.get()); 632 main_context->set_sdch_manager(sdch_manager_.get());
633 sdch_policy_->EnablePersistentStorage(network_json_store_.get());
614 634
615 // Create a media request context based on the main context, but using a 635 // Create a media request context based on the main context, but using a
616 // media cache. It shares the same job factory as the main context. 636 // media cache. It shares the same job factory as the main context.
617 StoragePartitionDescriptor details(profile_path_, false); 637 StoragePartitionDescriptor details(profile_path_, false);
618 media_request_context_.reset(InitializeMediaRequestContext(main_context, 638 media_request_context_.reset(InitializeMediaRequestContext(main_context,
619 details)); 639 details));
620 640
621 lazy_params_.reset(); 641 lazy_params_.reset();
622 } 642 }
623 643
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 const base::Closure& completion) { 866 const base::Closure& completion) {
847 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 867 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
848 DCHECK(initialized()); 868 DCHECK(initialized());
849 869
850 DCHECK(transport_security_state()); 870 DCHECK(transport_security_state());
851 // Completes synchronously. 871 // Completes synchronously.
852 transport_security_state()->DeleteAllDynamicDataSince(time); 872 transport_security_state()->DeleteAllDynamicDataSince(time);
853 DCHECK(http_server_properties_manager_); 873 DCHECK(http_server_properties_manager_);
854 http_server_properties_manager_->Clear(completion); 874 http_server_properties_manager_->Clear(completion);
855 } 875 }
OLDNEW
« 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