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

Unified Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 2874973002: Flush Channel IDs when Cookies get saved to a persistent backend (Closed)
Patch Set: Add missing background task runners Created 3 years, 7 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profiles/profile_impl_io_data.cc
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc
index 8eb31578fc4518f17fc7f0bbfd1de7c74d4e5643..005d4c2f79a7bb3c0e44eb94f9d1fd2f40465c55 100644
--- a/chrome/browser/profiles/profile_impl_io_data.cc
+++ b/chrome/browser/profiles/profile_impl_io_data.cc
@@ -490,6 +490,21 @@ void ProfileImplIOData::InitializeInternal(
main_context->set_proxy_service(proxy_service());
+ scoped_refptr<base::SequencedTaskRunner> background_task_runner =
mattm 2017/05/17 23:28:09 may want to add comment or different naming to con
nharper 2017/05/18 00:45:53 Done.
+ base::CreateSequencedTaskRunnerWithTraits(
+ {base::MayBlock(), base::TaskPriority::BACKGROUND,
+ base::TaskShutdownBehavior::BLOCK_SHUTDOWN});
+
+ // Set up server bound cert service.
+ DCHECK(!lazy_params_->channel_id_path.empty());
+ scoped_refptr<QuotaPolicyChannelIDStore> channel_id_db =
+ new QuotaPolicyChannelIDStore(lazy_params_->channel_id_path,
+ background_task_runner,
+ lazy_params_->special_storage_policy.get());
+ main_context_storage->set_channel_id_service(
+ base::MakeUnique<net::ChannelIDService>(
+ new net::DefaultChannelIDStore(channel_id_db.get())));
+
// Set up cookie store.
DCHECK(!lazy_params_->cookie_path.empty());
@@ -498,21 +513,11 @@ void ProfileImplIOData::InitializeInternal(
lazy_params_->special_storage_policy.get(),
profile_params->cookie_monster_delegate.get());
cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate();
+ cookie_config.channel_id_service = main_context->channel_id_service();
mattm 2017/05/17 23:28:08 Should this also be done in android_webview/browse
nharper 2017/05/18 00:45:53 android webview has a CookieManager::GetCookieStor
+ cookie_config.background_task_runner = background_task_runner;
main_context_storage->set_cookie_store(
content::CreateCookieStore(cookie_config));
- // Set up server bound cert service.
- DCHECK(!lazy_params_->channel_id_path.empty());
- scoped_refptr<QuotaPolicyChannelIDStore> channel_id_db =
- new QuotaPolicyChannelIDStore(
- lazy_params_->channel_id_path,
- base::CreateSequencedTaskRunnerWithTraits(
- {base::MayBlock(), base::TaskPriority::BACKGROUND}),
- lazy_params_->special_storage_policy.get());
- main_context_storage->set_channel_id_service(
- base::MakeUnique<net::ChannelIDService>(
- new net::DefaultChannelIDStore(channel_id_db.get())));
-
main_context->cookie_store()->SetChannelIDServiceID(
mattm 2017/05/17 23:28:09 Seems like this could be obviated as ChannelIDServ
nharper 2017/05/18 00:45:53 They should get merged together - I'd prefer to po
main_context->channel_id_service()->GetUniqueID());
@@ -585,6 +590,7 @@ void ProfileImplIOData::
cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate();
// Enable cookies for chrome-extension URLs.
cookie_config.cookieable_schemes.push_back(extensions::kExtensionScheme);
+ cookie_config.channel_id_service = extensions_context->channel_id_service();
extensions_cookie_store_ = content::CreateCookieStore(cookie_config);
extensions_context->set_cookie_store(extensions_cookie_store_.get());
if (extensions_context->channel_id_service()) {
@@ -639,28 +645,33 @@ net::URLRequestContext* ProfileImplIOData::InitializeAppRequestContext(
std::unique_ptr<net::CookieStore> cookie_store;
scoped_refptr<net::SQLiteChannelIDStore> channel_id_db;
+ scoped_refptr<base::SequencedTaskRunner> background_task_runner =
mattm 2017/05/17 23:28:09 same
nharper 2017/05/18 00:45:53 Done.
+ base::CreateSequencedTaskRunnerWithTraits(
+ {base::MayBlock(), base::TaskPriority::BACKGROUND,
+ base::TaskShutdownBehavior::BLOCK_SHUTDOWN});
if (partition_descriptor.in_memory) {
- cookie_store = content::CreateCookieStore(content::CookieStoreConfig());
- } else {
+ cookie_path = base::FilePath();
+ }
+ content::CookieStoreConfig cookie_config(
+ cookie_path, content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES,
+ nullptr, nullptr);
+ if (!partition_descriptor.in_memory) {
// Use an app-specific cookie store.
DCHECK(!cookie_path.empty());
// TODO(creis): We should have a cookie delegate for notifying the cookie
// extensions API, but we need to update it to understand isolated apps
// first.
- content::CookieStoreConfig cookie_config(
- cookie_path, content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES,
- nullptr, nullptr);
cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate();
- cookie_store = content::CreateCookieStore(cookie_config);
- channel_id_db = new net::SQLiteChannelIDStore(
- channel_id_path,
- base::CreateSequencedTaskRunnerWithTraits(
- {base::MayBlock(), base::TaskPriority::BACKGROUND}));
+ channel_id_db =
+ new net::SQLiteChannelIDStore(channel_id_path, background_task_runner);
}
std::unique_ptr<net::ChannelIDService> channel_id_service(
new net::ChannelIDService(
new net::DefaultChannelIDStore(channel_id_db.get())));
+ cookie_config.channel_id_service = channel_id_service.get();
+ cookie_config.background_task_runner = background_task_runner;
+ cookie_store = content::CreateCookieStore(cookie_config);
cookie_store->SetChannelIDServiceID(channel_id_service->GetUniqueID());
// Build a new HttpNetworkSession that uses the new ChannelIDService.
« no previous file with comments | « chrome/browser/net/quota_policy_channel_id_store.cc ('k') | chrome/browser/safe_browsing/safe_browsing_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698