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

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

Issue 1701063002: CookieStore: Remove reference counting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@threadsafe
Patch Set: Fix Created 4 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
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 <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "components/prefs/pref_service.h" 53 #include "components/prefs/pref_service.h"
54 #include "content/public/browser/browser_thread.h" 54 #include "content/public/browser/browser_thread.h"
55 #include "content/public/browser/cookie_store_factory.h" 55 #include "content/public/browser/cookie_store_factory.h"
56 #include "content/public/browser/notification_service.h" 56 #include "content/public/browser/notification_service.h"
57 #include "content/public/browser/resource_context.h" 57 #include "content/public/browser/resource_context.h"
58 #include "content/public/browser/storage_partition.h" 58 #include "content/public/browser/storage_partition.h"
59 #include "extensions/browser/extension_protocols.h" 59 #include "extensions/browser/extension_protocols.h"
60 #include "extensions/common/constants.h" 60 #include "extensions/common/constants.h"
61 #include "net/base/cache_type.h" 61 #include "net/base/cache_type.h"
62 #include "net/base/sdch_manager.h" 62 #include "net/base/sdch_manager.h"
63 #include "net/cookies/cookie_store.h"
63 #include "net/ftp/ftp_network_layer.h" 64 #include "net/ftp/ftp_network_layer.h"
64 #include "net/http/http_cache.h" 65 #include "net/http/http_cache.h"
65 #include "net/http/http_network_session.h" 66 #include "net/http/http_network_session.h"
66 #include "net/http/http_server_properties_manager.h" 67 #include "net/http/http_server_properties_manager.h"
67 #include "net/sdch/sdch_owner.h" 68 #include "net/sdch/sdch_owner.h"
68 #include "net/ssl/channel_id_service.h" 69 #include "net/ssl/channel_id_service.h"
69 #include "net/url_request/url_request_intercepting_job_factory.h" 70 #include "net/url_request/url_request_intercepting_job_factory.h"
70 #include "net/url_request/url_request_job_factory_impl.h" 71 #include "net/url_request/url_request_job_factory_impl.h"
71 #include "storage/browser/quota/special_storage_policy.h" 72 #include "storage/browser/quota/special_storage_policy.h"
72 73
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 main_context->set_host_resolver( 477 main_context->set_host_resolver(
477 io_thread_globals->host_resolver.get()); 478 io_thread_globals->host_resolver.get());
478 479
479 main_context->set_http_auth_handler_factory( 480 main_context->set_http_auth_handler_factory(
480 io_thread_globals->http_auth_handler_factory.get()); 481 io_thread_globals->http_auth_handler_factory.get());
481 482
482 main_context->set_proxy_service(proxy_service()); 483 main_context->set_proxy_service(proxy_service());
483 main_context->set_backoff_manager( 484 main_context->set_backoff_manager(
484 io_thread_globals->url_request_backoff_manager.get()); 485 io_thread_globals->url_request_backoff_manager.get());
485 486
486 scoped_refptr<net::CookieStore> cookie_store = NULL; 487 net::ChannelIDService* channel_id_service = nullptr;
487 net::ChannelIDService* channel_id_service = NULL;
488 488
489 // Set up cookie store. 489 // Set up cookie store.
490 if (!cookie_store.get()) { 490 DCHECK(!lazy_params_->cookie_path.empty());
Randy Smith (Not in Mondays) 2016/02/29 22:37:45 I know the code's going away, but: Huh? Won't thi
mmenke 2016/02/29 23:00:29 Yes, which is exactly why I removed it. :) I sus
491 DCHECK(!lazy_params_->cookie_path.empty());
492 491
493 content::CookieStoreConfig cookie_config( 492 content::CookieStoreConfig cookie_config(
494 lazy_params_->cookie_path, 493 lazy_params_->cookie_path, lazy_params_->session_cookie_mode,
495 lazy_params_->session_cookie_mode, 494 lazy_params_->special_storage_policy.get(),
496 lazy_params_->special_storage_policy.get(), 495 profile_params->cookie_monster_delegate.get());
497 profile_params->cookie_monster_delegate.get()); 496 cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate();
498 cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate(); 497 main_cookie_store_ = content::CreateCookieStore(cookie_config);
499 cookie_store = content::CreateCookieStore(cookie_config);
500 }
501 498
502 main_context->set_cookie_store(cookie_store.get()); 499 main_context->set_cookie_store(main_cookie_store_.get());
503 500
504 // Set up server bound cert service. 501 // Set up server bound cert service.
505 if (!channel_id_service) { 502 if (!channel_id_service) {
506 DCHECK(!lazy_params_->channel_id_path.empty()); 503 DCHECK(!lazy_params_->channel_id_path.empty());
507 504
508 scoped_refptr<QuotaPolicyChannelIDStore> channel_id_db = 505 scoped_refptr<QuotaPolicyChannelIDStore> channel_id_db =
509 new QuotaPolicyChannelIDStore( 506 new QuotaPolicyChannelIDStore(
510 lazy_params_->channel_id_path, 507 lazy_params_->channel_id_path,
511 BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( 508 BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
512 base::SequencedWorkerPool::GetSequenceToken()), 509 base::SequencedWorkerPool::GetSequenceToken()),
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 581
585 extensions_context->set_net_log(io_thread->net_log()); 582 extensions_context->set_net_log(io_thread->net_log());
586 583
587 content::CookieStoreConfig cookie_config( 584 content::CookieStoreConfig cookie_config(
588 lazy_params_->extensions_cookie_path, 585 lazy_params_->extensions_cookie_path,
589 lazy_params_->session_cookie_mode, 586 lazy_params_->session_cookie_mode,
590 NULL, NULL); 587 NULL, NULL);
591 cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate(); 588 cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate();
592 // Enable cookies for chrome-extension URLs. 589 // Enable cookies for chrome-extension URLs.
593 cookie_config.cookieable_schemes.push_back(extensions::kExtensionScheme); 590 cookie_config.cookieable_schemes.push_back(extensions::kExtensionScheme);
594 net::CookieStore* extensions_cookie_store = 591 extensions_cookie_store_ = content::CreateCookieStore(cookie_config);
595 content::CreateCookieStore(cookie_config); 592 extensions_context->set_cookie_store(extensions_cookie_store_.get());
596 extensions_context->set_cookie_store(extensions_cookie_store);
597 593
598 scoped_ptr<net::URLRequestJobFactoryImpl> extensions_job_factory( 594 scoped_ptr<net::URLRequestJobFactoryImpl> extensions_job_factory(
599 new net::URLRequestJobFactoryImpl()); 595 new net::URLRequestJobFactoryImpl());
600 // TODO(shalev): The extensions_job_factory has a NULL NetworkDelegate. 596 // TODO(shalev): The extensions_job_factory has a NULL NetworkDelegate.
601 // Without a network_delegate, this protocol handler will never 597 // Without a network_delegate, this protocol handler will never
602 // handle file: requests, but as a side effect it makes 598 // handle file: requests, but as a side effect it makes
603 // job_factory::IsHandledProtocol return true, which prevents attempts to 599 // job_factory::IsHandledProtocol return true, which prevents attempts to
604 // handle the protocol externally. We pass NULL in to 600 // handle the protocol externally. We pass NULL in to
605 // SetUpJobFactory() to get this effect. 601 // SetUpJobFactory() to get this effect.
606 extensions_job_factory_ = SetUpJobFactoryDefaults( 602 extensions_job_factory_ = SetUpJobFactoryDefaults(
(...skipping 30 matching lines...) Expand all
637 app_backend.reset(new net::HttpCache::DefaultBackend( 633 app_backend.reset(new net::HttpCache::DefaultBackend(
638 net::DISK_CACHE, 634 net::DISK_CACHE,
639 ChooseCacheBackendType(), 635 ChooseCacheBackendType(),
640 cache_path, 636 cache_path,
641 app_cache_max_size_, 637 app_cache_max_size_,
642 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE))); 638 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)));
643 } 639 }
644 scoped_ptr<net::HttpCache> app_http_cache = 640 scoped_ptr<net::HttpCache> app_http_cache =
645 CreateHttpFactory(http_network_session_.get(), std::move(app_backend)); 641 CreateHttpFactory(http_network_session_.get(), std::move(app_backend));
646 642
647 scoped_refptr<net::CookieStore> cookie_store = NULL; 643 scoped_ptr<net::CookieStore> cookie_store;
648 if (partition_descriptor.in_memory) { 644 if (partition_descriptor.in_memory) {
649 cookie_store = content::CreateCookieStore(content::CookieStoreConfig()); 645 cookie_store = content::CreateCookieStore(content::CookieStoreConfig());
650 } 646 } else {
651 647 // Use an app-specific cookie store.
652 // Use an app-specific cookie store.
653 if (!cookie_store.get()) {
654 DCHECK(!cookie_path.empty()); 648 DCHECK(!cookie_path.empty());
655 649
656 // TODO(creis): We should have a cookie delegate for notifying the cookie 650 // TODO(creis): We should have a cookie delegate for notifying the cookie
657 // extensions API, but we need to update it to understand isolated apps 651 // extensions API, but we need to update it to understand isolated apps
658 // first. 652 // first.
659 content::CookieStoreConfig cookie_config( 653 content::CookieStoreConfig cookie_config(
660 cookie_path, 654 cookie_path, content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES,
661 content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, 655 nullptr, nullptr);
662 NULL, NULL);
663 cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate(); 656 cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate();
664 cookie_store = content::CreateCookieStore(cookie_config); 657 cookie_store = content::CreateCookieStore(cookie_config);
665 } 658 }
666 659
667 // Transfer ownership of the cookies and cache to AppRequestContext. 660 // Transfer ownership of the cookies and cache to AppRequestContext.
668 context->SetCookieStore(cookie_store.get()); 661 context->SetCookieStore(std::move(cookie_store));
669 context->SetHttpTransactionFactory(std::move(app_http_cache)); 662 context->SetHttpTransactionFactory(std::move(app_http_cache));
670 663
671 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( 664 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
672 new net::URLRequestJobFactoryImpl()); 665 new net::URLRequestJobFactoryImpl());
673 InstallProtocolHandlers(job_factory.get(), protocol_handlers); 666 InstallProtocolHandlers(job_factory.get(), protocol_handlers);
674 // The data reduction proxy interceptor should be as close to the network 667 // The data reduction proxy interceptor should be as close to the network
675 // as possible. 668 // as possible.
676 request_interceptors.insert( 669 request_interceptors.insert(
677 request_interceptors.begin(), 670 request_interceptors.begin(),
678 data_reduction_proxy_io_data()->CreateInterceptor().release()); 671 data_reduction_proxy_io_data()->CreateInterceptor().release());
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 const base::Closure& completion) { 765 const base::Closure& completion) {
773 DCHECK_CURRENTLY_ON(BrowserThread::IO); 766 DCHECK_CURRENTLY_ON(BrowserThread::IO);
774 DCHECK(initialized()); 767 DCHECK(initialized());
775 768
776 DCHECK(transport_security_state()); 769 DCHECK(transport_security_state());
777 // Completes synchronously. 770 // Completes synchronously.
778 transport_security_state()->DeleteAllDynamicDataSince(time); 771 transport_security_state()->DeleteAllDynamicDataSince(time);
779 DCHECK(http_server_properties_manager_); 772 DCHECK(http_server_properties_manager_);
780 http_server_properties_manager_->Clear(completion); 773 http_server_properties_manager_->Clear(completion);
781 } 774 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl_io_data.h ('k') | chrome/browser/profiles/profile_io_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698