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

Side by Side 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: More fixes 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 <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 // Set up a persistent store for use by the network stack on the IO thread.
432 base::FilePath network_json_store_filepath(
433 profile_path_.Append(chrome::kNetworkPersistentStateFilename));
434 network_json_store_ = new JsonPrefStore(
435 network_json_store_filepath,
436 JsonPrefStore::GetTaskRunnerForFile(network_json_store_filepath,
437 BrowserThread::GetBlockingPool()),
438 scoped_ptr<PrefFilter>());
439 network_json_store_->ReadPrefsAsync(nullptr);
440
427 net::URLRequestContext* main_context = main_request_context(); 441 net::URLRequestContext* main_context = main_request_context();
428 442
429 IOThread* const io_thread = profile_params->io_thread; 443 IOThread* const io_thread = profile_params->io_thread;
430 IOThread::Globals* const io_thread_globals = io_thread->globals(); 444 IOThread::Globals* const io_thread_globals = io_thread->globals();
431 445
432 chrome_network_delegate->set_predictor(predictor_.get()); 446 chrome_network_delegate->set_predictor(predictor_.get());
433 447
434 if (domain_reliability_monitor_) { 448 if (domain_reliability_monitor_) {
435 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. 449 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed.
436 tracked_objects::ScopedTracker tracking_profile1( 450 tracked_objects::ScopedTracker tracking_profile1(
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 "436671 ProfileImplIOData::InitializeInternal9")); 619 "436671 ProfileImplIOData::InitializeInternal9"));
606 620
607 #if defined(ENABLE_EXTENSIONS) 621 #if defined(ENABLE_EXTENSIONS)
608 InitializeExtensionsRequestContext(profile_params); 622 InitializeExtensionsRequestContext(profile_params);
609 #endif 623 #endif
610 624
611 // Setup SDCH for this profile. 625 // Setup SDCH for this profile.
612 sdch_manager_.reset(new net::SdchManager); 626 sdch_manager_.reset(new net::SdchManager);
613 sdch_policy_.reset(new net::SdchOwner(sdch_manager_.get(), main_context)); 627 sdch_policy_.reset(new net::SdchOwner(sdch_manager_.get(), main_context));
614 main_context->set_sdch_manager(sdch_manager_.get()); 628 main_context->set_sdch_manager(sdch_manager_.get());
629 sdch_policy_->EnablePersistentStorage(network_json_store_.get());
615 630
616 // Create a media request context based on the main context, but using a 631 // Create a media request context based on the main context, but using a
617 // media cache. It shares the same job factory as the main context. 632 // media cache. It shares the same job factory as the main context.
618 StoragePartitionDescriptor details(profile_path_, false); 633 StoragePartitionDescriptor details(profile_path_, false);
619 media_request_context_.reset(InitializeMediaRequestContext(main_context, 634 media_request_context_.reset(InitializeMediaRequestContext(main_context,
620 details)); 635 details));
621 636
622 lazy_params_.reset(); 637 lazy_params_.reset();
623 } 638 }
624 639
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 const base::Closure& completion) { 862 const base::Closure& completion) {
848 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 863 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
849 DCHECK(initialized()); 864 DCHECK(initialized());
850 865
851 DCHECK(transport_security_state()); 866 DCHECK(transport_security_state());
852 // Completes synchronously. 867 // Completes synchronously.
853 transport_security_state()->DeleteAllDynamicDataSince(time); 868 transport_security_state()->DeleteAllDynamicDataSince(time);
854 DCHECK(http_server_properties_manager_); 869 DCHECK(http_server_properties_manager_);
855 http_server_properties_manager_->Clear(completion); 870 http_server_properties_manager_->Clear(completion);
856 } 871 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698