| Index: chrome/browser/profiles/profile_io_data.cc
|
| diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
|
| index 3b7e943bf469373a538d441e57b258381d59e18d..27f1ad5187d21a1c84a46a9bc391516eb001bd01 100644
|
| --- a/chrome/browser/profiles/profile_io_data.cc
|
| +++ b/chrome/browser/profiles/profile_io_data.cc
|
| @@ -8,7 +8,9 @@
|
|
|
| #include "base/basictypes.h"
|
| #include "base/command_line.h"
|
| +#include "base/compiler_specific.h"
|
| #include "base/logging.h"
|
| +#include "base/stl_util-inl.h"
|
| #include "base/string_number_conversions.h"
|
| #include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
|
| @@ -23,11 +25,13 @@
|
| #include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/pref_names.h"
|
| #include "content/browser/browser_thread.h"
|
| +#include "content/browser/resource_context.h"
|
| #include "content/common/notification_service.h"
|
| #include "net/http/http_util.h"
|
| #include "net/proxy/proxy_config_service_fixed.h"
|
| #include "net/proxy/proxy_script_fetcher_impl.h"
|
| #include "net/proxy/proxy_service.h"
|
| +#include "webkit/database/database_tracker.h"
|
|
|
| namespace {
|
|
|
| @@ -181,6 +185,35 @@ void ProfileIOData::InitializeProfileParams(Profile* profile,
|
| ProfileIOData::RequestContext::RequestContext() {}
|
| ProfileIOData::RequestContext::~RequestContext() {}
|
|
|
| +ProfileIOData::ProfileResourceContextGetter::ProfileResourceContextGetter(
|
| + ProfileIOData* profile_io_data)
|
| + : profile_io_data_(profile_io_data) {
|
| + base::AutoLock auto_lock(profile_io_data_->lock_);
|
| + std::set<const ProfileResourceContextGetter*>& getters =
|
| + profile_io_data_->resource_context_getters_;
|
| + DCHECK(!ContainsKey(getters, this));
|
| + getters.insert(this);
|
| +}
|
| +
|
| +ProfileIOData::ProfileResourceContextGetter::~ProfileResourceContextGetter() {
|
| + base::AutoLock auto_lock(profile_io_data_->lock_);
|
| + std::set<const ProfileResourceContextGetter*>& getters =
|
| + profile_io_data_->resource_context_getters_;
|
| + DCHECK(ContainsKey(getters, this));
|
| + getters.erase(this);
|
| +}
|
| +
|
| +#ifndef NDEBUG
|
| +void ProfileIOData::ProfileResourceContextGetter::PrintStacktrace() const {
|
| + stacktrace_.PrintBacktrace();
|
| +}
|
| +#endif
|
| +
|
| +const content::ResourceContext&
|
| +ProfileIOData::ProfileResourceContextGetter::GetImpl() {
|
| + return profile_io_data_->GetResourceContext();
|
| +}
|
| +
|
| ProfileIOData::ProfileParams::ProfileParams()
|
| : is_incognito(false),
|
| clear_local_state_on_exit(false),
|
| @@ -201,6 +234,17 @@ ProfileIOData::~ProfileIOData() {
|
| DCHECK(!initialized_);
|
| else
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| +
|
| + base::AutoLock auto_lock(lock_);
|
| +#ifndef NDEBUG
|
| + for (std::set<const ProfileResourceContextGetter*>::const_iterator it =
|
| + resource_context_getters_.begin(); it != resource_context_getters_.end();
|
| + ++it) {
|
| + LOG(ERROR) << "Leaked ProfileResourceContextGetter with allocation: ";
|
| + (*it)->PrintStacktrace();
|
| + }
|
| +#endif
|
| + DCHECK(resource_context_getters_.empty());
|
| }
|
|
|
| scoped_refptr<ChromeURLRequestContext>
|
| @@ -241,6 +285,19 @@ ProfileIOData::GetIsolatedAppRequestContext(
|
| return context;
|
| }
|
|
|
| +const content::ResourceContext& ProfileIOData::GetResourceContext() const {
|
| + LazyInitialize();
|
| + DCHECK(resource_context_.get());
|
| + return *resource_context_;
|
| +}
|
| +
|
| +void ProfileIOData::set_resource_context(
|
| + const content::ResourceContext* resource_context) const {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| + DCHECK(!resource_context_.get());
|
| + resource_context_.reset(resource_context);
|
| +}
|
| +
|
| void ProfileIOData::LazyInitialize() const {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| if (initialized_)
|
| @@ -264,7 +321,6 @@ void ProfileIOData::ApplyProfileParamsToContext(
|
| context->set_transport_security_state(
|
| profile_params.transport_security_state);
|
| context->set_ssl_config_service(profile_params.ssl_config_service);
|
| - context->set_database_tracker(profile_params.database_tracker);
|
| context->set_appcache_service(profile_params.appcache_service);
|
| context->set_blob_storage_context(profile_params.blob_storage_context);
|
| context->set_file_system_context(profile_params.file_system_context);
|
|
|