| OLD | NEW |
| 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_io_data.h" | 5 #include "chrome/browser/profiles/profile_io_data.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 if (policy_header_service) { | 536 if (policy_header_service) { |
| 537 policy_header_helper_ = | 537 policy_header_helper_ = |
| 538 policy_header_service->CreatePolicyHeaderIOHelper(io_task_runner); | 538 policy_header_service->CreatePolicyHeaderIOHelper(io_task_runner); |
| 539 } | 539 } |
| 540 } | 540 } |
| 541 | 541 |
| 542 incognito_availibility_pref_.Init( | 542 incognito_availibility_pref_.Init( |
| 543 prefs::kIncognitoModeAvailability, pref_service); | 543 prefs::kIncognitoModeAvailability, pref_service); |
| 544 incognito_availibility_pref_.MoveToThread(io_task_runner); | 544 incognito_availibility_pref_.MoveToThread(io_task_runner); |
| 545 | 545 |
| 546 initialized_on_UI_thread_ = true; | |
| 547 | |
| 548 // We need to make sure that content initializes its own data structures that | 546 // We need to make sure that content initializes its own data structures that |
| 549 // are associated with each ResourceContext because we might post this | 547 // are associated with each ResourceContext because we might post this |
| 550 // object to the IO thread after this function. | 548 // object to the IO thread after this function. |
| 551 BrowserContext::EnsureResourceContextInitialized(profile); | 549 BrowserContext::EnsureResourceContextInitialized(profile); |
| 552 } | 550 } |
| 553 | 551 |
| 554 ProfileIOData::MediaRequestContext::MediaRequestContext() { | 552 ProfileIOData::MediaRequestContext::MediaRequestContext() { |
| 555 } | 553 } |
| 556 | 554 |
| 557 void ProfileIOData::MediaRequestContext::SetHttpTransactionFactory( | 555 void ProfileIOData::MediaRequestContext::SetHttpTransactionFactory( |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 | 608 |
| 611 ProfileIOData::ProfileParams::~ProfileParams() {} | 609 ProfileIOData::ProfileParams::~ProfileParams() {} |
| 612 | 610 |
| 613 ProfileIOData::ProfileIOData(Profile::ProfileType profile_type) | 611 ProfileIOData::ProfileIOData(Profile::ProfileType profile_type) |
| 614 : initialized_(false), | 612 : initialized_(false), |
| 615 #if defined(OS_CHROMEOS) | 613 #if defined(OS_CHROMEOS) |
| 616 policy_cert_verifier_(NULL), | 614 policy_cert_verifier_(NULL), |
| 617 use_system_key_slot_(false), | 615 use_system_key_slot_(false), |
| 618 #endif | 616 #endif |
| 619 resource_context_(new ResourceContext(this)), | 617 resource_context_(new ResourceContext(this)), |
| 620 initialized_on_UI_thread_(false), | |
| 621 profile_type_(profile_type) { | 618 profile_type_(profile_type) { |
| 622 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 619 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 623 } | 620 } |
| 624 | 621 |
| 625 ProfileIOData::~ProfileIOData() { | 622 ProfileIOData::~ProfileIOData() { |
| 626 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) | 623 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) |
| 627 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 624 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 628 | 625 |
| 629 // Pull the contents of the request context maps onto the stack for sanity | 626 // Pull the contents of the request context maps onto the stack for sanity |
| 630 // checking of values in a minidump. http://crbug.com/260425 | 627 // checking of values in a minidump. http://crbug.com/260425 |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 } | 1007 } |
| 1011 | 1008 |
| 1012 void ProfileIOData::Init( | 1009 void ProfileIOData::Init( |
| 1013 content::ProtocolHandlerMap* protocol_handlers, | 1010 content::ProtocolHandlerMap* protocol_handlers, |
| 1014 content::URLRequestInterceptorScopedVector request_interceptors) const { | 1011 content::URLRequestInterceptorScopedVector request_interceptors) const { |
| 1015 // The basic logic is implemented here. The specific initialization | 1012 // The basic logic is implemented here. The specific initialization |
| 1016 // is done in InitializeInternal(), implemented by subtypes. Static helper | 1013 // is done in InitializeInternal(), implemented by subtypes. Static helper |
| 1017 // functions have been provided to assist in common operations. | 1014 // functions have been provided to assist in common operations. |
| 1018 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1015 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 1019 DCHECK(!initialized_); | 1016 DCHECK(!initialized_); |
| 1020 | 1017 DCHECK(profile_params_.get()); |
| 1021 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. | |
| 1022 CHECK(initialized_on_UI_thread_); | |
| 1023 | |
| 1024 // TODO(jhawkins): Return to DCHECK once crbug.com/102004 is fixed. | |
| 1025 CHECK(profile_params_.get()); | |
| 1026 | 1018 |
| 1027 IOThread* const io_thread = profile_params_->io_thread; | 1019 IOThread* const io_thread = profile_params_->io_thread; |
| 1028 IOThread::Globals* const io_thread_globals = io_thread->globals(); | 1020 IOThread::Globals* const io_thread_globals = io_thread->globals(); |
| 1029 const base::CommandLine& command_line = | 1021 const base::CommandLine& command_line = |
| 1030 *base::CommandLine::ForCurrentProcess(); | 1022 *base::CommandLine::ForCurrentProcess(); |
| 1031 | 1023 |
| 1032 // Create the common request contexts. | 1024 // Create the common request contexts. |
| 1033 main_request_context_.reset(new net::URLRequestContext()); | 1025 main_request_context_.reset(new net::URLRequestContext()); |
| 1034 extensions_request_context_.reset(new net::URLRequestContext()); | 1026 extensions_request_context_.reset(new net::URLRequestContext()); |
| 1035 | 1027 |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1340 base::WrapUnique(new DevToolsNetworkTransactionFactory( | 1332 base::WrapUnique(new DevToolsNetworkTransactionFactory( |
| 1341 network_controller_handle_.GetController(), shared_session)), | 1333 network_controller_handle_.GetController(), shared_session)), |
| 1342 std::move(backend), true /* set_up_quic_server_info */)); | 1334 std::move(backend), true /* set_up_quic_server_info */)); |
| 1343 } | 1335 } |
| 1344 | 1336 |
| 1345 void ProfileIOData::SetCookieSettingsForTesting( | 1337 void ProfileIOData::SetCookieSettingsForTesting( |
| 1346 content_settings::CookieSettings* cookie_settings) { | 1338 content_settings::CookieSettings* cookie_settings) { |
| 1347 DCHECK(!cookie_settings_.get()); | 1339 DCHECK(!cookie_settings_.get()); |
| 1348 cookie_settings_ = cookie_settings; | 1340 cookie_settings_ = cookie_settings; |
| 1349 } | 1341 } |
| OLD | NEW |