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

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

Issue 12321143: Move cookie DB to the blocking pool. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move ALL the cookie DBs to the blocking pool. Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/prefs/public/pref_member.h" 12 #include "base/prefs/public/pref_member.h"
13 #include "base/sequenced_task_runner.h"
13 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/threading/sequenced_worker_pool.h"
14 #include "base/threading/worker_pool.h" 16 #include "base/threading/worker_pool.h"
15 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 17 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
16 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" 18 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
17 #include "chrome/browser/io_thread.h" 19 #include "chrome/browser/io_thread.h"
18 #include "chrome/browser/net/chrome_net_log.h" 20 #include "chrome/browser/net/chrome_net_log.h"
19 #include "chrome/browser/net/chrome_network_delegate.h" 21 #include "chrome/browser/net/chrome_network_delegate.h"
20 #include "chrome/browser/net/clear_on_exit_policy.h" 22 #include "chrome/browser/net/clear_on_exit_policy.h"
21 #include "chrome/browser/net/connect_interceptor.h" 23 #include "chrome/browser/net/connect_interceptor.h"
22 #include "chrome/browser/net/http_server_properties_manager.h" 24 #include "chrome/browser/net/http_server_properties_manager.h"
23 #include "chrome/browser/net/predictor.h" 25 #include "chrome/browser/net/predictor.h"
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 } 384 }
383 385
384 // setup cookie store 386 // setup cookie store
385 if (!cookie_store) { 387 if (!cookie_store) {
386 DCHECK(!lazy_params_->cookie_path.empty()); 388 DCHECK(!lazy_params_->cookie_path.empty());
387 389
388 scoped_refptr<SQLitePersistentCookieStore> cookie_db = 390 scoped_refptr<SQLitePersistentCookieStore> cookie_db =
389 new SQLitePersistentCookieStore( 391 new SQLitePersistentCookieStore(
390 lazy_params_->cookie_path, 392 lazy_params_->cookie_path,
391 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), 393 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
392 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), 394 BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
395 BrowserThread::GetBlockingPool()->GetSequenceToken()),
393 lazy_params_->restore_old_session_cookies, 396 lazy_params_->restore_old_session_cookies,
394 new ClearOnExitPolicy(lazy_params_->special_storage_policy)); 397 new ClearOnExitPolicy(lazy_params_->special_storage_policy));
395 cookie_store = 398 cookie_store =
396 new net::CookieMonster(cookie_db.get(), 399 new net::CookieMonster(cookie_db.get(),
397 profile_params->cookie_monster_delegate); 400 profile_params->cookie_monster_delegate);
398 cookie_store->GetCookieMonster()->SetPersistSessionCookies(true); 401 cookie_store->GetCookieMonster()->SetPersistSessionCookies(true);
399 } 402 }
400 403
401 main_context->set_cookie_store(cookie_store); 404 main_context->set_cookie_store(cookie_store);
402 405
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 extensions_context->set_net_log(io_thread->net_log()); 495 extensions_context->set_net_log(io_thread->net_log());
493 496
494 extensions_context->set_throttler_manager( 497 extensions_context->set_throttler_manager(
495 io_thread_globals->throttler_manager.get()); 498 io_thread_globals->throttler_manager.get());
496 499
497 net::CookieMonster* extensions_cookie_store = 500 net::CookieMonster* extensions_cookie_store =
498 new net::CookieMonster( 501 new net::CookieMonster(
499 new SQLitePersistentCookieStore( 502 new SQLitePersistentCookieStore(
500 lazy_params_->extensions_cookie_path, 503 lazy_params_->extensions_cookie_path,
501 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), 504 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
502 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), 505 BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
506 BrowserThread::GetBlockingPool()->GetSequenceToken()),
503 lazy_params_->restore_old_session_cookies, NULL), NULL); 507 lazy_params_->restore_old_session_cookies, NULL), NULL);
504 // Enable cookies for devtools and extension URLs. 508 // Enable cookies for devtools and extension URLs.
505 const char* schemes[] = {chrome::kChromeDevToolsScheme, 509 const char* schemes[] = {chrome::kChromeDevToolsScheme,
506 extensions::kExtensionScheme}; 510 extensions::kExtensionScheme};
507 extensions_cookie_store->SetCookieableSchemes(schemes, 2); 511 extensions_cookie_store->SetCookieableSchemes(schemes, 2);
508 extensions_context->set_cookie_store(extensions_cookie_store); 512 extensions_context->set_cookie_store(extensions_cookie_store);
509 513
510 #if !defined(DISABLE_FTP_SUPPORT) 514 #if !defined(DISABLE_FTP_SUPPORT)
511 DCHECK(ftp_factory_.get()); 515 DCHECK(ftp_factory_.get());
512 extensions_context->set_ftp_transaction_factory(ftp_factory_.get()); 516 extensions_context->set_ftp_transaction_factory(ftp_factory_.get());
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 } 596 }
593 597
594 // Use an app-specific cookie store. 598 // Use an app-specific cookie store.
595 if (!cookie_store) { 599 if (!cookie_store) {
596 DCHECK(!cookie_path.empty()); 600 DCHECK(!cookie_path.empty());
597 601
598 scoped_refptr<SQLitePersistentCookieStore> cookie_db = 602 scoped_refptr<SQLitePersistentCookieStore> cookie_db =
599 new SQLitePersistentCookieStore( 603 new SQLitePersistentCookieStore(
600 cookie_path, 604 cookie_path,
601 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), 605 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
602 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), 606 BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
607 BrowserThread::GetBlockingPool()->GetSequenceToken()),
603 false, 608 false,
604 NULL); 609 NULL);
605 // TODO(creis): We should have a cookie delegate for notifying the cookie 610 // TODO(creis): We should have a cookie delegate for notifying the cookie
606 // extensions API, but we need to update it to understand isolated apps 611 // extensions API, but we need to update it to understand isolated apps
607 // first. 612 // first.
608 cookie_store = new net::CookieMonster(cookie_db.get(), NULL); 613 cookie_store = new net::CookieMonster(cookie_db.get(), NULL);
609 } 614 }
610 615
611 // Transfer ownership of the cookies and cache to AppRequestContext. 616 // Transfer ownership of the cookies and cache to AppRequestContext.
612 context->SetCookieStore(cookie_store); 617 context->SetCookieStore(cookie_store);
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 base::Time time, 757 base::Time time,
753 const base::Closure& completion) { 758 const base::Closure& completion) {
754 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 759 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
755 DCHECK(initialized()); 760 DCHECK(initialized());
756 761
757 DCHECK(transport_security_state()); 762 DCHECK(transport_security_state());
758 transport_security_state()->DeleteSince(time); // Completes synchronously. 763 transport_security_state()->DeleteSince(time); // Completes synchronously.
759 DCHECK(http_server_properties_manager_); 764 DCHECK(http_server_properties_manager_);
760 http_server_properties_manager_->Clear(completion); 765 http_server_properties_manager_->Clear(completion);
761 } 766 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698