OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/browser_state/chrome_browser_state_io_data.h" | 5 #include "ios/chrome/browser/browser_state/chrome_browser_state_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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 google_services_user_account_id_.Init(prefs::kGoogleServicesUserAccountId, | 121 google_services_user_account_id_.Init(prefs::kGoogleServicesUserAccountId, |
122 pref_service); | 122 pref_service); |
123 google_services_user_account_id_.MoveToThread(io_task_runner); | 123 google_services_user_account_id_.MoveToThread(io_task_runner); |
124 | 124 |
125 sync_disabled_.Init(sync_driver::prefs::kSyncManaged, pref_service); | 125 sync_disabled_.Init(sync_driver::prefs::kSyncManaged, pref_service); |
126 sync_disabled_.MoveToThread(io_task_runner); | 126 sync_disabled_.MoveToThread(io_task_runner); |
127 | 127 |
128 signin_allowed_.Init(prefs::kSigninAllowed, pref_service); | 128 signin_allowed_.Init(prefs::kSigninAllowed, pref_service); |
129 signin_allowed_.MoveToThread(io_task_runner); | 129 signin_allowed_.MoveToThread(io_task_runner); |
130 } | 130 } |
131 | |
132 initialized_on_UI_thread_ = true; | |
133 } | 131 } |
134 | 132 |
135 ChromeBrowserStateIOData::AppRequestContext::AppRequestContext() {} | 133 ChromeBrowserStateIOData::AppRequestContext::AppRequestContext() {} |
136 | 134 |
137 void ChromeBrowserStateIOData::AppRequestContext::SetCookieStore( | 135 void ChromeBrowserStateIOData::AppRequestContext::SetCookieStore( |
138 std::unique_ptr<net::CookieStore> cookie_store) { | 136 std::unique_ptr<net::CookieStore> cookie_store) { |
139 cookie_store_ = std::move(cookie_store); | 137 cookie_store_ = std::move(cookie_store); |
140 set_cookie_store(cookie_store_.get()); | 138 set_cookie_store(cookie_store_.get()); |
141 } | 139 } |
142 | 140 |
(...skipping 25 matching lines...) Expand all Loading... |
168 } | 166 } |
169 | 167 |
170 ChromeBrowserStateIOData::ProfileParams::ProfileParams() | 168 ChromeBrowserStateIOData::ProfileParams::ProfileParams() |
171 : io_thread(nullptr), browser_state(nullptr) {} | 169 : io_thread(nullptr), browser_state(nullptr) {} |
172 | 170 |
173 ChromeBrowserStateIOData::ProfileParams::~ProfileParams() {} | 171 ChromeBrowserStateIOData::ProfileParams::~ProfileParams() {} |
174 | 172 |
175 ChromeBrowserStateIOData::ChromeBrowserStateIOData( | 173 ChromeBrowserStateIOData::ChromeBrowserStateIOData( |
176 ios::ChromeBrowserStateType browser_state_type) | 174 ios::ChromeBrowserStateType browser_state_type) |
177 : initialized_(false), | 175 : initialized_(false), |
178 initialized_on_UI_thread_(false), | |
179 browser_state_type_(browser_state_type) { | 176 browser_state_type_(browser_state_type) { |
180 DCHECK_CURRENTLY_ON(web::WebThread::UI); | 177 DCHECK_CURRENTLY_ON(web::WebThread::UI); |
181 } | 178 } |
182 | 179 |
183 ChromeBrowserStateIOData::~ChromeBrowserStateIOData() { | 180 ChromeBrowserStateIOData::~ChromeBrowserStateIOData() { |
184 if (web::WebThread::IsMessageLoopValid(web::WebThread::IO)) | 181 if (web::WebThread::IsMessageLoopValid(web::WebThread::IO)) |
185 DCHECK_CURRENTLY_ON(web::WebThread::IO); | 182 DCHECK_CURRENTLY_ON(web::WebThread::IO); |
186 | 183 |
187 // Pull the contents of the request context maps onto the stack for sanity | 184 // Pull the contents of the request context maps onto the stack for sanity |
188 // checking of values in a minidump. http://crbug.com/260425 | 185 // checking of values in a minidump. http://crbug.com/260425 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 http_server_properties_ = std::move(http_server_properties); | 328 http_server_properties_ = std::move(http_server_properties); |
332 } | 329 } |
333 | 330 |
334 void ChromeBrowserStateIOData::Init( | 331 void ChromeBrowserStateIOData::Init( |
335 ProtocolHandlerMap* protocol_handlers) const { | 332 ProtocolHandlerMap* protocol_handlers) const { |
336 // The basic logic is implemented here. The specific initialization | 333 // The basic logic is implemented here. The specific initialization |
337 // is done in InitializeInternal(), implemented by subtypes. Static helper | 334 // is done in InitializeInternal(), implemented by subtypes. Static helper |
338 // functions have been provided to assist in common operations. | 335 // functions have been provided to assist in common operations. |
339 DCHECK_CURRENTLY_ON(web::WebThread::IO); | 336 DCHECK_CURRENTLY_ON(web::WebThread::IO); |
340 DCHECK(!initialized_); | 337 DCHECK(!initialized_); |
341 | 338 DCHECK(profile_params_.get()); |
342 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. | |
343 CHECK(initialized_on_UI_thread_); | |
344 | |
345 // TODO(jhawkins): Return to DCHECK once crbug.com/102004 is fixed. | |
346 CHECK(profile_params_.get()); | |
347 | 339 |
348 IOSChromeIOThread* const io_thread = profile_params_->io_thread; | 340 IOSChromeIOThread* const io_thread = profile_params_->io_thread; |
349 IOSChromeIOThread::Globals* const io_thread_globals = io_thread->globals(); | 341 IOSChromeIOThread::Globals* const io_thread_globals = io_thread->globals(); |
350 | 342 |
351 // Create the common request contexts. | 343 // Create the common request contexts. |
352 main_request_context_.reset(new net::URLRequestContext()); | 344 main_request_context_.reset(new net::URLRequestContext()); |
353 | 345 |
354 std::unique_ptr<IOSChromeNetworkDelegate> network_delegate( | 346 std::unique_ptr<IOSChromeNetworkDelegate> network_delegate( |
355 new IOSChromeNetworkDelegate()); | 347 new IOSChromeNetworkDelegate()); |
356 | 348 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 return std::unique_ptr<net::HttpCache>( | 482 return std::unique_ptr<net::HttpCache>( |
491 new net::HttpCache(session, std::move(main_backend), true)); | 483 new net::HttpCache(session, std::move(main_backend), true)); |
492 } | 484 } |
493 | 485 |
494 std::unique_ptr<net::HttpCache> ChromeBrowserStateIOData::CreateHttpFactory( | 486 std::unique_ptr<net::HttpCache> ChromeBrowserStateIOData::CreateHttpFactory( |
495 net::HttpNetworkSession* shared_session, | 487 net::HttpNetworkSession* shared_session, |
496 std::unique_ptr<net::HttpCache::BackendFactory> backend) const { | 488 std::unique_ptr<net::HttpCache::BackendFactory> backend) const { |
497 return std::unique_ptr<net::HttpCache>( | 489 return std::unique_ptr<net::HttpCache>( |
498 new net::HttpCache(shared_session, std::move(backend), true)); | 490 new net::HttpCache(shared_session, std::move(backend), true)); |
499 } | 491 } |
OLD | NEW |