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

Side by Side Diff: ios/chrome/browser/browser_state/chrome_browser_state_impl_io_data.mm

Issue 1701063002: CookieStore: Remove reference counting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@threadsafe
Patch Set: Small 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ios/chrome/browser/browser_state/chrome_browser_state_impl_io_data.h" 5 #include "ios/chrome/browser/browser_state/chrome_browser_state_impl_io_data.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 20 matching lines...) Expand all
31 #include "ios/chrome/browser/ios_chrome_io_thread.h" 31 #include "ios/chrome/browser/ios_chrome_io_thread.h"
32 #include "ios/chrome/browser/net/cookie_util.h" 32 #include "ios/chrome/browser/net/cookie_util.h"
33 #include "ios/chrome/browser/net/http_server_properties_manager_factory.h" 33 #include "ios/chrome/browser/net/http_server_properties_manager_factory.h"
34 #include "ios/chrome/browser/net/ios_chrome_network_delegate.h" 34 #include "ios/chrome/browser/net/ios_chrome_network_delegate.h"
35 #include "ios/chrome/browser/net/ios_chrome_url_request_context_getter.h" 35 #include "ios/chrome/browser/net/ios_chrome_url_request_context_getter.h"
36 #include "ios/chrome/browser/pref_names.h" 36 #include "ios/chrome/browser/pref_names.h"
37 #include "ios/net/cookies/cookie_store_ios.h" 37 #include "ios/net/cookies/cookie_store_ios.h"
38 #include "ios/web/public/web_thread.h" 38 #include "ios/web/public/web_thread.h"
39 #include "net/base/cache_type.h" 39 #include "net/base/cache_type.h"
40 #include "net/base/sdch_manager.h" 40 #include "net/base/sdch_manager.h"
41 #include "net/cookies/cookie_store.h"
41 #include "net/extras/sqlite/sqlite_channel_id_store.h" 42 #include "net/extras/sqlite/sqlite_channel_id_store.h"
42 #include "net/http/http_cache.h" 43 #include "net/http/http_cache.h"
43 #include "net/http/http_network_session.h" 44 #include "net/http/http_network_session.h"
44 #include "net/http/http_server_properties_manager.h" 45 #include "net/http/http_server_properties_manager.h"
45 #include "net/sdch/sdch_owner.h" 46 #include "net/sdch/sdch_owner.h"
46 #include "net/ssl/channel_id_service.h" 47 #include "net/ssl/channel_id_service.h"
47 #include "net/ssl/default_channel_id_store.h" 48 #include "net/ssl/default_channel_id_store.h"
48 #include "net/url_request/url_request_intercepting_job_factory.h" 49 #include "net/url_request/url_request_intercepting_job_factory.h"
49 #include "net/url_request/url_request_job_factory_impl.h" 50 #include "net/url_request/url_request_job_factory_impl.h"
50 51
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 366
366 main_context->set_host_resolver(io_thread_globals->host_resolver.get()); 367 main_context->set_host_resolver(io_thread_globals->host_resolver.get());
367 368
368 main_context->set_http_auth_handler_factory( 369 main_context->set_http_auth_handler_factory(
369 io_thread_globals->http_auth_handler_factory.get()); 370 io_thread_globals->http_auth_handler_factory.get());
370 371
371 main_context->set_proxy_service(proxy_service()); 372 main_context->set_proxy_service(proxy_service());
372 main_context->set_backoff_manager( 373 main_context->set_backoff_manager(
373 io_thread_globals->url_request_backoff_manager.get()); 374 io_thread_globals->url_request_backoff_manager.get());
374 375
375 scoped_refptr<net::CookieStore> cookie_store = NULL;
376 net::ChannelIDService* channel_id_service = NULL; 376 net::ChannelIDService* channel_id_service = NULL;
377 377
378 // Set up cookie store. 378 DCHECK(!lazy_params_->cookie_path.empty());
379 if (!cookie_store.get()) { 379 cookie_util::CookieStoreConfig ios_cookie_config(
380 DCHECK(!lazy_params_->cookie_path.empty()); 380 lazy_params_->cookie_path,
381 cookie_util::CookieStoreConfig ios_cookie_config( 381 cookie_util::CookieStoreConfig::RESTORED_SESSION_COOKIES,
382 lazy_params_->cookie_path, 382 cookie_util::CookieStoreConfig::COOKIE_STORE_IOS,
383 cookie_util::CookieStoreConfig::RESTORED_SESSION_COOKIES, 383 cookie_config::GetCookieCryptoDelegate());
384 cookie_util::CookieStoreConfig::COOKIE_STORE_IOS, 384 main_cookie_store_ = cookie_util::CreateCookieStore(ios_cookie_config);
385 cookie_config::GetCookieCryptoDelegate());
386 cookie_store = cookie_util::CreateCookieStore(ios_cookie_config);
387 385
388 if (profile_params->path.BaseName().value() == 386 if (profile_params->path.BaseName().value() ==
389 kIOSChromeInitialBrowserState) { 387 kIOSChromeInitialBrowserState) {
390 // Enable metrics on the default profile, not secondary profiles. 388 // Enable metrics on the default profile, not secondary profiles.
391 static_cast<net::CookieStoreIOS*>(cookie_store.get()) 389 static_cast<net::CookieStoreIOS*>(main_cookie_store_.get())
392 ->SetMetricsEnabled(); 390 ->SetMetricsEnabled();
393 }
394 } 391 }
395 392
396 main_context->set_cookie_store(cookie_store.get()); 393 main_context->set_cookie_store(main_cookie_store_.get());
397 394
398 // Set up server bound cert service. 395 // Set up server bound cert service.
399 if (!channel_id_service) { 396 if (!channel_id_service) {
400 DCHECK(!lazy_params_->channel_id_path.empty()); 397 DCHECK(!lazy_params_->channel_id_path.empty());
401 398
402 scoped_refptr<net::SQLiteChannelIDStore> channel_id_db = 399 scoped_refptr<net::SQLiteChannelIDStore> channel_id_db =
403 new net::SQLiteChannelIDStore( 400 new net::SQLiteChannelIDStore(
404 lazy_params_->channel_id_path, 401 lazy_params_->channel_id_path,
405 web::WebThread::GetBlockingPool()->GetSequencedTaskRunner( 402 web::WebThread::GetBlockingPool()->GetSequencedTaskRunner(
406 web::WebThread::GetBlockingPool()->GetSequenceToken())); 403 web::WebThread::GetBlockingPool()->GetSequenceToken()));
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 // Use a separate HTTP disk cache for isolated apps. 456 // Use a separate HTTP disk cache for isolated apps.
460 scoped_ptr<net::HttpCache::BackendFactory> app_backend = 457 scoped_ptr<net::HttpCache::BackendFactory> app_backend =
461 net::HttpCache::DefaultBackend::InMemory(0); 458 net::HttpCache::DefaultBackend::InMemory(0);
462 scoped_ptr<net::HttpCache> app_http_cache = 459 scoped_ptr<net::HttpCache> app_http_cache =
463 CreateHttpFactory(http_network_session_.get(), std::move(app_backend)); 460 CreateHttpFactory(http_network_session_.get(), std::move(app_backend));
464 461
465 cookie_util::CookieStoreConfig ios_cookie_config( 462 cookie_util::CookieStoreConfig ios_cookie_config(
466 base::FilePath(), 463 base::FilePath(),
467 cookie_util::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, 464 cookie_util::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES,
468 cookie_util::CookieStoreConfig::COOKIE_STORE_IOS, nullptr); 465 cookie_util::CookieStoreConfig::COOKIE_STORE_IOS, nullptr);
469 scoped_refptr<net::CookieStore> cookie_store = 466 scoped_ptr<net::CookieStore> cookie_store =
470 cookie_util::CreateCookieStore(ios_cookie_config); 467 cookie_util::CreateCookieStore(ios_cookie_config);
471 468
472 // Transfer ownership of the cookies and cache to AppRequestContext. 469 // Transfer ownership of the cookies and cache to AppRequestContext.
473 context->SetCookieStore(cookie_store.get()); 470 context->SetCookieStore(std::move(cookie_store));
474 context->SetHttpTransactionFactory(std::move(app_http_cache)); 471 context->SetHttpTransactionFactory(std::move(app_http_cache));
475 472
476 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( 473 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
477 new net::URLRequestJobFactoryImpl()); 474 new net::URLRequestJobFactoryImpl());
478 // The data reduction proxy interceptor should be as close to the network as 475 // The data reduction proxy interceptor should be as close to the network as
479 // possible. 476 // possible.
480 URLRequestInterceptorScopedVector request_interceptors; 477 URLRequestInterceptorScopedVector request_interceptors;
481 request_interceptors.insert( 478 request_interceptors.insert(
482 request_interceptors.begin(), 479 request_interceptors.begin(),
483 data_reduction_proxy_io_data()->CreateInterceptor().release()); 480 data_reduction_proxy_io_data()->CreateInterceptor().release());
(...skipping 20 matching lines...) Expand all
504 const base::Closure& completion) { 501 const base::Closure& completion) {
505 DCHECK_CURRENTLY_ON(web::WebThread::IO); 502 DCHECK_CURRENTLY_ON(web::WebThread::IO);
506 DCHECK(initialized()); 503 DCHECK(initialized());
507 504
508 DCHECK(transport_security_state()); 505 DCHECK(transport_security_state());
509 // Completes synchronously. 506 // Completes synchronously.
510 transport_security_state()->DeleteAllDynamicDataSince(time); 507 transport_security_state()->DeleteAllDynamicDataSince(time);
511 DCHECK(http_server_properties_manager_); 508 DCHECK(http_server_properties_manager_);
512 http_server_properties_manager_->Clear(completion); 509 http_server_properties_manager_->Clear(completion);
513 } 510 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698