| Index: chrome/browser/io_thread.cc
|
| diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
|
| index 7ba293b4aa722777912079c517dc83c48885599d..21b1ed69147d81749e817709731b912acb3081d9 100644
|
| --- a/chrome/browser/io_thread.cc
|
| +++ b/chrome/browser/io_thread.cc
|
| @@ -42,6 +42,7 @@
|
| #include "chrome/common/chrome_content_client.h"
|
| #include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/pref_names.h"
|
| +#include "components/certificate_transparency/tree_state_tracker.h"
|
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs.h"
|
| #include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h"
|
| #include "components/data_usage/core/data_use_aggregator.h"
|
| @@ -435,6 +436,7 @@ IOThread::IOThread(
|
| globals_(NULL),
|
| is_spdy_disabled_by_policy_(false),
|
| is_quic_allowed_by_policy_(true),
|
| + sth_reporter_(nullptr),
|
| creation_time_(base::TimeTicks::Now()),
|
| weak_factory_(this) {
|
| scoped_refptr<base::SingleThreadTaskRunner> io_thread_proxy =
|
| @@ -517,6 +519,7 @@ IOThread::~IOThread() {
|
| BrowserThread::SetDelegate(BrowserThread::IO, NULL);
|
|
|
| pref_proxy_config_tracker_->DetachFromPrefService();
|
| + DCHECK(sth_observers_.empty());
|
| DCHECK(!globals_);
|
| }
|
|
|
| @@ -871,6 +874,17 @@ void IOThread::CleanUp() {
|
|
|
| // Release objects that the net::URLRequestContext could have been pointing
|
| // to.
|
| + globals()->cert_transparency_verifier->SetObserver(nullptr);
|
| +
|
| + VLOG(1) << "XXX: IOThread::CleanUp";
|
| + if (sth_reporter_) {
|
| + for (auto observer : sth_observers_) {
|
| + sth_reporter_->UnregisterObserver(observer);
|
| + }
|
| + // Make sure no registration happens after CleanUp
|
| + sth_reporter_ = nullptr;
|
| + }
|
| + sth_observers_.clear();
|
|
|
| // Shutdown the HistogramWatcher on the IO thread.
|
| net::NetworkChangeNotifier::ShutdownHistogramWatcher();
|
| @@ -1213,6 +1227,22 @@ void IOThread::InitSystemRequestContextOnIOThread() {
|
|
|
| globals_->system_request_context.reset(
|
| ConstructSystemRequestContext(globals_, net_log_));
|
| +
|
| + VLOG(1) << "Creating TreeStateTracker observer on IOThread.";
|
| + // TODO(eranm): Clean up the order of pointer creation and
|
| + // moving around. This should be a scoped_ptr until ownership
|
| + // is transferred to globals_->cert_transparency_observer
|
| + certificate_transparency::TreeStateTracker* scts_observer(
|
| + new certificate_transparency::TreeStateTracker(globals_->ct_logs));
|
| + globals_->cert_transparency_observer.reset(scts_observer);
|
| + RegisterSTHObserver(scts_observer);
|
| + VLOG(1)
|
| + << "XXX IOThread::InitSystemRequestContextOnIOThread, created observer.";
|
| + // The |cert_transparency_verifier| is the same one held by
|
| + // the |proxy_script_fetcher_context| and |system_request_context|,
|
| + // so no need to set the observer in their cert_transparency_verifiers.
|
| + globals_->cert_transparency_verifier->SetObserver(scts_observer);
|
| + VLOG(1) << "TreeStateTracker observer on IOThread created.";
|
| }
|
|
|
| void IOThread::UpdateDnsClientEnabled() {
|
| @@ -1406,6 +1436,35 @@ bool IOThread::ShouldEnableQuicPortSelection(
|
| return false; // Default to disabling port selection on all channels.
|
| }
|
|
|
| +void IOThread::RegisterSTHReporter(net::ct::STHReporter* reporter) {
|
| + DCHECK(globals());
|
| + // Just a sanity check to make sure it was created by now.
|
| + DCHECK(globals()->cert_transparency_observer.get());
|
| +
|
| + VLOG(1) << "XXX IOThread::RegisterWithSTHObserver";
|
| +
|
| + // globals()->sth_observers_registrar.AssignReporter(reporter);
|
| + sth_reporter_ = reporter;
|
| + for (auto observer : sth_observers_) {
|
| + sth_reporter_->RegisterObserver(observer);
|
| + }
|
| +}
|
| +
|
| +void IOThread::RegisterSTHObserver(net::ct::STHObserver* observer) {
|
| + sth_observers_.insert(observer);
|
| + if (sth_reporter_) {
|
| + sth_reporter_->RegisterObserver(observer);
|
| + }
|
| +}
|
| +
|
| +void IOThread::UnregisterSTHObserver(net::ct::STHObserver* observer) {
|
| + DCHECK_NE(sth_observers_.count(observer), 0u);
|
| + sth_observers_.erase(observer);
|
| + if (sth_reporter_) {
|
| + sth_reporter_->UnregisterObserver(observer);
|
| + }
|
| +}
|
| +
|
| net::QuicTagVector IOThread::GetQuicConnectionOptions(
|
| const base::CommandLine& command_line,
|
| const VariationParameters& quic_trial_params) {
|
|
|