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

Side by Side Diff: components/domain_reliability/monitor.cc

Issue 2336043007: Domain Reliability: Don't crash on shutdown with uploads pending (Closed)
Patch Set: Shutdown uploader in unittest Created 4 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/domain_reliability/monitor.h" 5 #include "components/domain_reliability/monitor.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 // Make sure the URLRequestContext actually lives on what was declared to be 149 // Make sure the URLRequestContext actually lives on what was declared to be
150 // the network thread. 150 // the network thread.
151 DCHECK(url_request_context_getter->GetNetworkTaskRunner()-> 151 DCHECK(url_request_context_getter->GetNetworkTaskRunner()->
152 RunsTasksOnCurrentThread()); 152 RunsTasksOnCurrentThread());
153 153
154 uploader_ = DomainReliabilityUploader::Create(time_.get(), 154 uploader_ = DomainReliabilityUploader::Create(time_.get(),
155 url_request_context_getter); 155 url_request_context_getter);
156 } 156 }
157 157
158 void DomainReliabilityMonitor::Shutdown() {
159 uploader_->Shutdown();
mmenke 2016/09/27 16:56:15 If it can, we should have a test for it. If it ca
160 }
161
158 void DomainReliabilityMonitor::AddBakedInConfigs() { 162 void DomainReliabilityMonitor::AddBakedInConfigs() {
159 DCHECK(OnNetworkThread()); 163 DCHECK(OnNetworkThread());
160 DCHECK(moved_to_network_thread_); 164 DCHECK(moved_to_network_thread_);
161 165
162 for (size_t i = 0; kBakedInJsonConfigs[i]; ++i) { 166 for (size_t i = 0; kBakedInJsonConfigs[i]; ++i) {
163 base::StringPiece json(kBakedInJsonConfigs[i]); 167 base::StringPiece json(kBakedInJsonConfigs[i]);
164 std::unique_ptr<const DomainReliabilityConfig> config = 168 std::unique_ptr<const DomainReliabilityConfig> config =
165 DomainReliabilityConfig::FromJSON(json); 169 DomainReliabilityConfig::FromJSON(json);
166 if (!config) { 170 if (!config) {
167 DLOG(WARNING) << "Baked-in Domain Reliability config failed to parse: " 171 DLOG(WARNING) << "Baked-in Domain Reliability config failed to parse: "
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 break; 419 break;
416 } 420 }
417 } 421 }
418 422
419 base::WeakPtr<DomainReliabilityMonitor> 423 base::WeakPtr<DomainReliabilityMonitor>
420 DomainReliabilityMonitor::MakeWeakPtr() { 424 DomainReliabilityMonitor::MakeWeakPtr() {
421 return weak_factory_.GetWeakPtr(); 425 return weak_factory_.GetWeakPtr();
422 } 426 }
423 427
424 } // namespace domain_reliability 428 } // namespace domain_reliability
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698