OLD | NEW |
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_impl_io_data.h" | 5 #include "chrome/browser/profiles/profile_impl_io_data.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 io_data_->lazy_params_.reset(lazy_params); | 70 io_data_->lazy_params_.reset(lazy_params); |
71 | 71 |
72 // Keep track of isolated app path separately so we can use it on demand. | 72 // Keep track of isolated app path separately so we can use it on demand. |
73 io_data_->app_path_ = app_path; | 73 io_data_->app_path_ = app_path; |
74 } | 74 } |
75 | 75 |
76 const content::ResourceContext& | 76 const content::ResourceContext& |
77 ProfileImplIOData::Handle::GetResourceContext() const { | 77 ProfileImplIOData::Handle::GetResourceContext() const { |
78 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 78 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
79 LazyInitialize(); | 79 // Don't call LazyInitialize here, since the resource context is created at |
| 80 // the beginning of initalization and is used by some members while they're |
| 81 // being initialized (i.e. AppCacheService). |
80 return io_data_->GetResourceContext(); | 82 return io_data_->GetResourceContext(); |
81 } | 83 } |
82 | 84 |
83 scoped_refptr<ChromeURLRequestContextGetter> | 85 scoped_refptr<ChromeURLRequestContextGetter> |
84 ProfileImplIOData::Handle::GetMainRequestContextGetter() const { | 86 ProfileImplIOData::Handle::GetMainRequestContextGetter() const { |
85 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 87 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
86 LazyInitialize(); | 88 LazyInitialize(); |
87 if (!main_request_context_getter_) { | 89 if (!main_request_context_getter_) { |
88 main_request_context_getter_ = | 90 main_request_context_getter_ = |
89 ChromeURLRequestContextGetter::CreateOriginal( | 91 ChromeURLRequestContextGetter::CreateOriginal( |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 ProfileImplIOData::AcquireIsolatedAppRequestContext( | 369 ProfileImplIOData::AcquireIsolatedAppRequestContext( |
368 scoped_refptr<ChromeURLRequestContext> main_context, | 370 scoped_refptr<ChromeURLRequestContext> main_context, |
369 const std::string& app_id) const { | 371 const std::string& app_id) const { |
370 // We create per-app contexts on demand, unlike the others above. | 372 // We create per-app contexts on demand, unlike the others above. |
371 scoped_refptr<RequestContext> app_request_context = | 373 scoped_refptr<RequestContext> app_request_context = |
372 InitializeAppRequestContext(main_context, app_id); | 374 InitializeAppRequestContext(main_context, app_id); |
373 DCHECK(app_request_context); | 375 DCHECK(app_request_context); |
374 app_request_context->set_profile_io_data(this); | 376 app_request_context->set_profile_io_data(this); |
375 return app_request_context; | 377 return app_request_context; |
376 } | 378 } |
OLD | NEW |