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

Side by Side Diff: chrome/browser/profiles/profile_io_data.cc

Issue 8341088: ProfileIOData: Add a few CHECKs to help debug a crash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/profiles/profile_io_data.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 profile_params_.reset(params.release()); 244 profile_params_.reset(params.release());
245 245
246 // The URLBlacklistManager has to be created on the UI thread to register 246 // The URLBlacklistManager has to be created on the UI thread to register
247 // observers of |pref_service|, and it also has to clean up on 247 // observers of |pref_service|, and it also has to clean up on
248 // ShutdownOnUIThread to release these observers on the right thread. 248 // ShutdownOnUIThread to release these observers on the right thread.
249 // Don't pass it in |profile_params_| to make sure it is correctly cleaned up, 249 // Don't pass it in |profile_params_| to make sure it is correctly cleaned up,
250 // in particular when this ProfileIOData isn't |initialized_| during deletion. 250 // in particular when this ProfileIOData isn't |initialized_| during deletion.
251 #if defined(ENABLE_CONFIGURATION_POLICY) 251 #if defined(ENABLE_CONFIGURATION_POLICY)
252 url_blacklist_manager_.reset(new policy::URLBlacklistManager(pref_service)); 252 url_blacklist_manager_.reset(new policy::URLBlacklistManager(pref_service));
253 #endif 253 #endif
254
255 initialized_on_UI_thread_ = true;
254 } 256 }
255 257
256 ProfileIOData::AppRequestContext::AppRequestContext() {} 258 ProfileIOData::AppRequestContext::AppRequestContext() {}
257 ProfileIOData::AppRequestContext::~AppRequestContext() {} 259 ProfileIOData::AppRequestContext::~AppRequestContext() {}
258 260
259 void ProfileIOData::AppRequestContext::SetCookieStore( 261 void ProfileIOData::AppRequestContext::SetCookieStore(
260 net::CookieStore* cookie_store) { 262 net::CookieStore* cookie_store) {
261 cookie_store_ = cookie_store; 263 cookie_store_ = cookie_store;
262 set_cookie_store(cookie_store); 264 set_cookie_store(cookie_store);
263 } 265 }
264 266
265 void ProfileIOData::AppRequestContext::SetHttpTransactionFactory( 267 void ProfileIOData::AppRequestContext::SetHttpTransactionFactory(
266 net::HttpTransactionFactory* http_factory) { 268 net::HttpTransactionFactory* http_factory) {
267 http_factory_.reset(http_factory); 269 http_factory_.reset(http_factory);
268 set_http_transaction_factory(http_factory); 270 set_http_transaction_factory(http_factory);
269 } 271 }
270 272
271 ProfileIOData::ProfileParams::ProfileParams() 273 ProfileIOData::ProfileParams::ProfileParams()
272 : is_incognito(false), 274 : is_incognito(false),
273 clear_local_state_on_exit(false), 275 clear_local_state_on_exit(false),
274 io_thread(NULL), 276 io_thread(NULL),
275 notification_service(NULL), 277 notification_service(NULL),
276 profile(NULL) {} 278 profile(NULL) {}
277 ProfileIOData::ProfileParams::~ProfileParams() {} 279 ProfileIOData::ProfileParams::~ProfileParams() {}
278 280
279 ProfileIOData::ProfileIOData(bool is_incognito) 281 ProfileIOData::ProfileIOData(bool is_incognito)
280 : initialized_(false), 282 : initialized_(false),
281 ALLOW_THIS_IN_INITIALIZER_LIST(resource_context_(this)) { 283 ALLOW_THIS_IN_INITIALIZER_LIST(resource_context_(this)),
284 initialized_on_UI_thread_(false) {
282 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 285 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
283 } 286 }
284 287
285 ProfileIOData::~ProfileIOData() { 288 ProfileIOData::~ProfileIOData() {
286 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) 289 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO))
287 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 290 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
288 } 291 }
289 292
290 // static 293 // static
291 bool ProfileIOData::IsHandledProtocol(const std::string& scheme) { 294 bool ProfileIOData::IsHandledProtocol(const std::string& scheme) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 ProfileIOData::ResourceContext::~ResourceContext() {} 386 ProfileIOData::ResourceContext::~ResourceContext() {}
384 387
385 void ProfileIOData::ResourceContext::EnsureInitialized() const { 388 void ProfileIOData::ResourceContext::EnsureInitialized() const {
386 io_data_->LazyInitialize(); 389 io_data_->LazyInitialize();
387 } 390 }
388 391
389 void ProfileIOData::LazyInitialize() const { 392 void ProfileIOData::LazyInitialize() const {
390 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 393 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
391 if (initialized_) 394 if (initialized_)
392 return; 395 return;
393 DCHECK(profile_params_.get()); 396
397 // TODO(jhawkins): Remove once crbug.com/102004 is fixed.
398 CHECK(initialized_on_UI_thread_);
399
400 // TODO(jhawkins): Return to DCHECK once crbug.com/102004 is fixed.
401 CHECK(profile_params_.get());
394 402
395 IOThread* const io_thread = profile_params_->io_thread; 403 IOThread* const io_thread = profile_params_->io_thread;
396 IOThread::Globals* const io_thread_globals = io_thread->globals(); 404 IOThread::Globals* const io_thread_globals = io_thread->globals();
397 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 405 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
398 406
399 // Create the common request contexts. 407 // Create the common request contexts.
400 main_request_context_ = new ChromeURLRequestContext; 408 main_request_context_ = new ChromeURLRequestContext;
401 extensions_request_context_ = new ChromeURLRequestContext; 409 extensions_request_context_ = new ChromeURLRequestContext;
402 410
403 profile_params_->appcache_service->set_request_context(main_request_context_); 411 profile_params_->appcache_service->set_request_context(main_request_context_);
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 bool posted = BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 544 bool posted = BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
537 new DeleteTask<ProfileIOData>(this)); 545 new DeleteTask<ProfileIOData>(this));
538 if (!posted) 546 if (!posted)
539 delete this; 547 delete this;
540 } 548 }
541 549
542 void ProfileIOData::set_origin_bound_cert_service( 550 void ProfileIOData::set_origin_bound_cert_service(
543 net::OriginBoundCertService* origin_bound_cert_service) const { 551 net::OriginBoundCertService* origin_bound_cert_service) const {
544 origin_bound_cert_service_.reset(origin_bound_cert_service); 552 origin_bound_cert_service_.reset(origin_bound_cert_service);
545 } 553 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_io_data.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698