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

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: 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 // 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);
Bernhard Bauer 2015/02/06 16:40:27 AFAIU the discussion on the previous CL, the conse
Elly Fong-Jones 2015/02/06 18:44:09 Done.
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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 "436671 ProfileImplIOData::InitializeInternal9")); 624 "436671 ProfileImplIOData::InitializeInternal9"));
606 625
607 #if defined(ENABLE_EXTENSIONS) 626 #if defined(ENABLE_EXTENSIONS)
608 InitializeExtensionsRequestContext(profile_params); 627 InitializeExtensionsRequestContext(profile_params);
609 #endif 628 #endif
610 629
611 // Setup SDCH for this profile. 630 // Setup SDCH for this profile.
612 sdch_manager_.reset(new net::SdchManager); 631 sdch_manager_.reset(new net::SdchManager);
613 sdch_policy_.reset(new net::SdchOwner(sdch_manager_.get(), main_context)); 632 sdch_policy_.reset(new net::SdchOwner(sdch_manager_.get(), main_context));
614 main_context->set_sdch_manager(sdch_manager_.get()); 633 main_context->set_sdch_manager(sdch_manager_.get());
634 sdch_policy_->EnablePersistentStorage(network_json_store_.get());
615 635
616 // Create a media request context based on the main context, but using a 636 // 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. 637 // media cache. It shares the same job factory as the main context.
618 StoragePartitionDescriptor details(profile_path_, false); 638 StoragePartitionDescriptor details(profile_path_, false);
619 media_request_context_.reset(InitializeMediaRequestContext(main_context, 639 media_request_context_.reset(InitializeMediaRequestContext(main_context,
620 details)); 640 details));
621 641
622 lazy_params_.reset(); 642 lazy_params_.reset();
623 } 643 }
624 644
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 const base::Closure& completion) { 867 const base::Closure& completion) {
848 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 868 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
849 DCHECK(initialized()); 869 DCHECK(initialized());
850 870
851 DCHECK(transport_security_state()); 871 DCHECK(transport_security_state());
852 // Completes synchronously. 872 // Completes synchronously.
853 transport_security_state()->DeleteAllDynamicDataSince(time); 873 transport_security_state()->DeleteAllDynamicDataSince(time);
854 DCHECK(http_server_properties_manager_); 874 DCHECK(http_server_properties_manager_);
855 http_server_properties_manager_->Clear(completion); 875 http_server_properties_manager_->Clear(completion);
856 } 876 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698