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

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: 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
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/metrics/field_trial.h" 11 #include "base/metrics/field_trial.h"
12 #include "base/prefs/json_pref_store.h"
13 #include "base/prefs/pref_filter.h"
12 #include "base/prefs/pref_member.h" 14 #include "base/prefs/pref_member.h"
13 #include "base/prefs/pref_service.h" 15 #include "base/prefs/pref_service.h"
14 #include "base/profiler/scoped_tracker.h" 16 #include "base/profiler/scoped_tracker.h"
15 #include "base/sequenced_task_runner.h" 17 #include "base/sequenced_task_runner.h"
16 #include "base/stl_util.h" 18 #include "base/stl_util.h"
17 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
18 #include "base/threading/sequenced_worker_pool.h" 20 #include "base/threading/sequenced_worker_pool.h"
19 #include "base/threading/worker_pool.h" 21 #include "base/threading/worker_pool.h"
20 #include "chrome/browser/browser_process.h" 22 #include "chrome/browser/browser_process.h"
21 #include "chrome/browser/chrome_notification_types.h" 23 #include "chrome/browser/chrome_notification_types.h"
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 void ProfileImplIOData::InitializeInternal( 419 void ProfileImplIOData::InitializeInternal(
418 scoped_ptr<ChromeNetworkDelegate> chrome_network_delegate, 420 scoped_ptr<ChromeNetworkDelegate> chrome_network_delegate,
419 ProfileParams* profile_params, 421 ProfileParams* profile_params,
420 content::ProtocolHandlerMap* protocol_handlers, 422 content::ProtocolHandlerMap* protocol_handlers,
421 content::URLRequestInterceptorScopedVector request_interceptors) const { 423 content::URLRequestInterceptorScopedVector request_interceptors) const {
422 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. 424 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed.
423 tracked_objects::ScopedTracker tracking_profile( 425 tracked_objects::ScopedTracker tracking_profile(
424 FROM_HERE_WITH_EXPLICIT_FUNCTION( 426 FROM_HERE_WITH_EXPLICIT_FUNCTION(
425 "436671 ProfileImplIOData::InitializeInternal")); 427 "436671 ProfileImplIOData::InitializeInternal"));
426 428
429 // Setup a persistent store for use by the network stack on the IO thread.
mmenke 2015/01/30 20:18:40 Setup -> Set up (Setup is a noun, Set up a verb)
Randy Smith (Not in Mondays) 2015/01/31 02:53:29 Done.
430 base::FilePath network_json_store_filepath(
431 profile_path_.Append(chrome::kNetworkPersistentStateFilename));
432 network_json_store_ = new JsonPrefStore(
433 network_json_store_filepath,
434 JsonPrefStore::GetTaskRunnerForFile(network_json_store_filepath,
435 BrowserThread::GetBlockingPool()),
436 scoped_ptr<PrefFilter>());
437
427 net::URLRequestContext* main_context = main_request_context(); 438 net::URLRequestContext* main_context = main_request_context();
428 439
429 IOThread* const io_thread = profile_params->io_thread; 440 IOThread* const io_thread = profile_params->io_thread;
430 IOThread::Globals* const io_thread_globals = io_thread->globals(); 441 IOThread::Globals* const io_thread_globals = io_thread->globals();
431 442
432 chrome_network_delegate->set_predictor(predictor_.get()); 443 chrome_network_delegate->set_predictor(predictor_.get());
433 444
434 if (domain_reliability_monitor_) { 445 if (domain_reliability_monitor_) {
435 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. 446 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed.
436 tracked_objects::ScopedTracker tracking_profile1( 447 tracked_objects::ScopedTracker tracking_profile1(
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 "436671 ProfileImplIOData::InitializeInternal9")); 615 "436671 ProfileImplIOData::InitializeInternal9"));
605 616
606 #if defined(ENABLE_EXTENSIONS) 617 #if defined(ENABLE_EXTENSIONS)
607 InitializeExtensionsRequestContext(profile_params); 618 InitializeExtensionsRequestContext(profile_params);
608 #endif 619 #endif
609 620
610 // Setup SDCH for this profile. 621 // Setup SDCH for this profile.
611 sdch_manager_.reset(new net::SdchManager); 622 sdch_manager_.reset(new net::SdchManager);
612 sdch_policy_.reset(new net::SdchOwner(sdch_manager_.get(), main_context)); 623 sdch_policy_.reset(new net::SdchOwner(sdch_manager_.get(), main_context));
613 main_context->set_sdch_manager(sdch_manager_.get()); 624 main_context->set_sdch_manager(sdch_manager_.get());
625 sdch_policy_->EnablePersistentStorage(network_json_store_.get());
614 626
615 // Create a media request context based on the main context, but using a 627 // 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. 628 // media cache. It shares the same job factory as the main context.
617 StoragePartitionDescriptor details(profile_path_, false); 629 StoragePartitionDescriptor details(profile_path_, false);
618 media_request_context_.reset(InitializeMediaRequestContext(main_context, 630 media_request_context_.reset(InitializeMediaRequestContext(main_context,
619 details)); 631 details));
620 632
621 lazy_params_.reset(); 633 lazy_params_.reset();
622 } 634 }
623 635
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 const base::Closure& completion) { 858 const base::Closure& completion) {
847 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 859 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
848 DCHECK(initialized()); 860 DCHECK(initialized());
849 861
850 DCHECK(transport_security_state()); 862 DCHECK(transport_security_state());
851 // Completes synchronously. 863 // Completes synchronously.
852 transport_security_state()->DeleteAllDynamicDataSince(time); 864 transport_security_state()->DeleteAllDynamicDataSince(time);
853 DCHECK(http_server_properties_manager_); 865 DCHECK(http_server_properties_manager_);
854 http_server_properties_manager_->Clear(completion); 866 http_server_properties_manager_->Clear(completion);
855 } 867 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698