Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <memory> | 7 #include <memory> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 #include "chrome/browser/profiles/profile.h" | 40 #include "chrome/browser/profiles/profile.h" |
| 41 #include "chrome/common/chrome_constants.h" | 41 #include "chrome/common/chrome_constants.h" |
| 42 #include "chrome/common/chrome_switches.h" | 42 #include "chrome/common/chrome_switches.h" |
| 43 #include "chrome/common/pref_names.h" | 43 #include "chrome/common/pref_names.h" |
| 44 #include "chrome/common/url_constants.h" | 44 #include "chrome/common/url_constants.h" |
| 45 #include "components/cookie_config/cookie_store_util.h" | 45 #include "components/cookie_config/cookie_store_util.h" |
| 46 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d ata.h" | 46 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d ata.h" |
| 47 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h" | 47 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h" |
| 48 #include "components/data_reduction_proxy/core/browser/data_store_impl.h" | 48 #include "components/data_reduction_proxy/core/browser/data_store_impl.h" |
| 49 #include "components/domain_reliability/monitor.h" | 49 #include "components/domain_reliability/monitor.h" |
| 50 #include "components/metrics/data_use_tracker.h" | |
| 51 #include "components/metrics/metrics_service.h" | |
| 50 #include "components/net_log/chrome_net_log.h" | 52 #include "components/net_log/chrome_net_log.h" |
| 51 #include "components/prefs/json_pref_store.h" | 53 #include "components/prefs/json_pref_store.h" |
| 52 #include "components/prefs/pref_filter.h" | 54 #include "components/prefs/pref_filter.h" |
| 53 #include "components/prefs/pref_member.h" | 55 #include "components/prefs/pref_member.h" |
| 54 #include "components/prefs/pref_service.h" | 56 #include "components/prefs/pref_service.h" |
| 55 #include "components/previews/core/previews_io_data.h" | 57 #include "components/previews/core/previews_io_data.h" |
| 56 #include "content/public/browser/browser_thread.h" | 58 #include "content/public/browser/browser_thread.h" |
| 57 #include "content/public/browser/cookie_store_factory.h" | 59 #include "content/public/browser/cookie_store_factory.h" |
| 58 #include "content/public/browser/notification_service.h" | 60 #include "content/public/browser/notification_service.h" |
| 59 #include "content/public/browser/resource_context.h" | 61 #include "content/public/browser/resource_context.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 } | 106 } |
| 105 #endif // #if !defined(OS_ANDROID) | 107 #endif // #if !defined(OS_ANDROID) |
| 106 | 108 |
| 107 #if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) | 109 #if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) |
| 108 return net::CACHE_BACKEND_SIMPLE; | 110 return net::CACHE_BACKEND_SIMPLE; |
| 109 #else | 111 #else |
| 110 return net::CACHE_BACKEND_BLOCKFILE; | 112 return net::CACHE_BACKEND_BLOCKFILE; |
| 111 #endif | 113 #endif |
| 112 } | 114 } |
| 113 | 115 |
| 116 metrics::UpdateUsagePrefCallbackType GetMetricsDataUseForwarder() { | |
| 117 // Some unit tests use IOThread but do not initialize MetricsService. In that | |
| 118 // case it is fine not to return a real forwarder. | |
| 119 if (g_browser_process->metrics_service()) { | |
| 120 return g_browser_process->metrics_service()->GetDataUseForwardingCallback(); | |
| 121 } | |
| 122 return metrics::UpdateUsagePrefCallbackType(); | |
| 123 } | |
| 124 | |
| 114 } // namespace | 125 } // namespace |
| 115 | 126 |
| 116 using content::BrowserThread; | 127 using content::BrowserThread; |
| 117 | 128 |
| 118 ProfileImplIOData::Handle::Handle(Profile* profile) | 129 ProfileImplIOData::Handle::Handle(Profile* profile) |
| 119 : io_data_(new ProfileImplIOData), | 130 : io_data_(new ProfileImplIOData), |
| 120 profile_(profile), | 131 profile_(profile), |
| 121 initialized_(false) { | 132 initialized_(false) { |
| 122 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 133 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 123 DCHECK(profile); | 134 DCHECK(profile); |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 420 media_cache_max_size(0), | 431 media_cache_max_size(0), |
| 421 session_cookie_mode( | 432 session_cookie_mode( |
| 422 content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES) {} | 433 content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES) {} |
| 423 | 434 |
| 424 ProfileImplIOData::LazyParams::~LazyParams() {} | 435 ProfileImplIOData::LazyParams::~LazyParams() {} |
| 425 | 436 |
| 426 ProfileImplIOData::ProfileImplIOData() | 437 ProfileImplIOData::ProfileImplIOData() |
| 427 : ProfileIOData(Profile::REGULAR_PROFILE), | 438 : ProfileIOData(Profile::REGULAR_PROFILE), |
| 428 http_server_properties_manager_(NULL), | 439 http_server_properties_manager_(NULL), |
| 429 app_cache_max_size_(0), | 440 app_cache_max_size_(0), |
| 430 app_media_cache_max_size_(0) { | 441 app_media_cache_max_size_(0), |
| 442 metrics_data_use_forwarder_(GetMetricsDataUseForwarder()) { | |
| 431 } | 443 } |
| 432 | 444 |
| 433 ProfileImplIOData::~ProfileImplIOData() { | 445 ProfileImplIOData::~ProfileImplIOData() { |
| 434 DestroyResourceContext(); | 446 DestroyResourceContext(); |
| 435 | 447 |
| 436 if (media_request_context_) | 448 if (media_request_context_) |
| 437 media_request_context_->AssertNoURLRequests(); | 449 media_request_context_->AssertNoURLRequests(); |
| 438 } | 450 } |
| 439 | 451 |
| 440 void ProfileImplIOData::InitializeInternal( | 452 void ProfileImplIOData::InitializeInternal( |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 478 | 490 |
| 479 main_context->set_transport_security_state(transport_security_state()); | 491 main_context->set_transport_security_state(transport_security_state()); |
| 480 main_context->set_ct_policy_enforcer( | 492 main_context->set_ct_policy_enforcer( |
| 481 io_thread_globals->ct_policy_enforcer.get()); | 493 io_thread_globals->ct_policy_enforcer.get()); |
| 482 | 494 |
| 483 main_context->set_net_log(io_thread->net_log()); | 495 main_context->set_net_log(io_thread->net_log()); |
| 484 | 496 |
| 485 main_context_storage->set_network_delegate( | 497 main_context_storage->set_network_delegate( |
| 486 data_reduction_proxy_io_data()->CreateNetworkDelegate( | 498 data_reduction_proxy_io_data()->CreateNetworkDelegate( |
| 487 io_thread_globals->data_use_ascriber->CreateNetworkDelegate( | 499 io_thread_globals->data_use_ascriber->CreateNetworkDelegate( |
| 488 std::move(chrome_network_delegate), | 500 std::move(chrome_network_delegate), metrics_data_use_forwarder_), |
|
Alexei Svitkine (slow)
2016/11/28 23:04:18
Why can't it get it from IO thread like before?
I
robliao
2016/11/29 18:17:43
This changes the relationship from
1. MetricsServi
Alexei Svitkine (slow)
2016/11/29 18:34:34
So my concern with this is now it's duplicating so
robliao
2016/11/30 02:22:46
Acknowledged. This is no longer an issue as I've p
| |
| 489 io_thread->GetMetricsDataUseForwarder()), | |
| 490 true)); | 501 true)); |
| 491 | 502 |
| 492 main_context->set_host_resolver( | 503 main_context->set_host_resolver( |
| 493 io_thread_globals->host_resolver.get()); | 504 io_thread_globals->host_resolver.get()); |
| 494 | 505 |
| 495 main_context->set_http_auth_handler_factory( | 506 main_context->set_http_auth_handler_factory( |
| 496 io_thread_globals->http_auth_handler_factory.get()); | 507 io_thread_globals->http_auth_handler_factory.get()); |
| 497 | 508 |
| 498 main_context->set_proxy_service(proxy_service()); | 509 main_context->set_proxy_service(proxy_service()); |
| 499 | 510 |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 806 const base::Closure& completion) { | 817 const base::Closure& completion) { |
| 807 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 818 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 808 DCHECK(initialized()); | 819 DCHECK(initialized()); |
| 809 | 820 |
| 810 DCHECK(transport_security_state()); | 821 DCHECK(transport_security_state()); |
| 811 // Completes synchronously. | 822 // Completes synchronously. |
| 812 transport_security_state()->DeleteAllDynamicDataSince(time); | 823 transport_security_state()->DeleteAllDynamicDataSince(time); |
| 813 DCHECK(http_server_properties_manager_); | 824 DCHECK(http_server_properties_manager_); |
| 814 http_server_properties_manager_->Clear(completion); | 825 http_server_properties_manager_->Clear(completion); |
| 815 } | 826 } |
| OLD | NEW |