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

Side by Side Diff: components/cronet/stale_host_resolver.cc

Issue 2470913003: cronet: Fix StaleHostResolver.AddressListDelta histogram. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/cronet/stale_host_resolver.h" 5 #include "components/cronet/stale_host_resolver.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 network_request_.reset(); 288 network_request_.reset();
289 result_callback_ = net::CompletionCallback(); 289 result_callback_ = net::CompletionCallback();
290 RecordCanceledRequest(); 290 RecordCanceledRequest();
291 } 291 }
292 292
293 if (!returning_result_ && !have_handle() && !have_network_request()) 293 if (!returning_result_ && !have_handle() && !have_network_request())
294 delete this; 294 delete this;
295 } 295 }
296 296
297 int StaleHostResolver::RequestImpl::HandleResult(int rv, 297 int StaleHostResolver::RequestImpl::HandleResult(int rv,
298 net::AddressList* addresses) { 298 net::AddressList* addresses) {
xunjieli 2016/11/01 21:14:16 Can we change the argument from pointer to const r
Julia Tuttle 2016/11/02 16:33:41 Done.
299 DCHECK(result_addresses_); 299 DCHECK(result_addresses_);
300 300
301 if (rv == net::OK) { 301 if (rv == net::OK)
302 *result_addresses_ = *addresses; 302 *result_addresses_ = *addresses;
303 addresses->clear();
304 }
305 result_addresses_ = nullptr; 303 result_addresses_ = nullptr;
306 return rv; 304 return rv;
307 } 305 }
308 306
309 void StaleHostResolver::RequestImpl::ReturnResult(int rv, 307 void StaleHostResolver::RequestImpl::ReturnResult(int rv,
310 net::AddressList* addresses) { 308 net::AddressList* addresses) {
311 DCHECK(result_callback_); 309 DCHECK(result_callback_);
312 returning_result_ = true; 310 returning_result_ = true;
313 base::ResetAndReturn(&result_callback_).Run(HandleResult(rv, addresses)); 311 base::ResetAndReturn(&result_callback_).Run(HandleResult(rv, addresses));
314 returning_result_ = false; 312 returning_result_ = false;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 389
392 net::HostCache* StaleHostResolver::GetHostCache() { 390 net::HostCache* StaleHostResolver::GetHostCache() {
393 return inner_resolver_->GetHostCache(); 391 return inner_resolver_->GetHostCache();
394 } 392 }
395 393
396 std::unique_ptr<base::Value> StaleHostResolver::GetDnsConfigAsValue() const { 394 std::unique_ptr<base::Value> StaleHostResolver::GetDnsConfigAsValue() const {
397 return inner_resolver_->GetDnsConfigAsValue(); 395 return inner_resolver_->GetDnsConfigAsValue();
398 } 396 }
399 397
400 } // namespace net 398 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698