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

Side by Side Diff: components/rappor/log_uploader.cc

Issue 188103004: C++ Readability review for holte (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed comments Created 6 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 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 // Change for readability
6
5 #include "components/rappor/log_uploader.h" 7 #include "components/rappor/log_uploader.h"
6 8
7 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
8 #include "base/metrics/sparse_histogram.h" 10 #include "base/metrics/sparse_histogram.h"
9 #include "net/base/load_flags.h" 11 #include "net/base/load_flags.h"
10 #include "net/url_request/url_fetcher.h" 12 #include "net/url_request/url_fetcher.h"
11 13
12 namespace { 14 namespace {
13 15
14 // The delay, in seconds, between uploading when there are queued logs to send. 16 // The delay, in seconds, between uploading when there are queued logs to send.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 return interval > max_interval ? max_interval : interval; 97 return interval > max_interval ? max_interval : interval;
96 } 98 }
97 99
98 void LogUploader::OnURLFetchComplete(const net::URLFetcher* source) { 100 void LogUploader::OnURLFetchComplete(const net::URLFetcher* source) {
99 // We're not allowed to re-use the existing |URLFetcher|s, so free them here. 101 // We're not allowed to re-use the existing |URLFetcher|s, so free them here.
100 // Note however that |source| is aliased to the fetcher, so we should be 102 // Note however that |source| is aliased to the fetcher, so we should be
101 // careful not to delete it too early. 103 // careful not to delete it too early.
102 DCHECK_EQ(current_fetch_.get(), source); 104 DCHECK_EQ(current_fetch_.get(), source);
103 scoped_ptr<net::URLFetcher> fetch(current_fetch_.Pass()); 105 scoped_ptr<net::URLFetcher> fetch(current_fetch_.Pass());
104 106
105 int response_code = source->GetResponseCode(); 107 int response_code = source->GetResponseCode();
ktl 2014/03/18 08:35:01 This variable (and upload_succeeded and server_is_
Steven Holte 2014/03/19 23:46:55 Done.
106 108
107 // Log a histogram to track response success vs. failure rates. 109 // Log a histogram to track response success vs. failure rates.
108 UMA_HISTOGRAM_SPARSE_SLOWLY("Rappor.UploadResponseCode", response_code); 110 UMA_HISTOGRAM_SPARSE_SLOWLY("Rappor.UploadResponseCode", response_code);
109 111
110 bool upload_succeeded = response_code == 200; 112 bool upload_succeeded = response_code == 200;
111 113
112 // Determine whether this log should be retransmitted. 114 // Determine whether this log should be retransmitted.
113 DiscardReason reason = NUM_DISCARD_REASONS; 115 DiscardReason reason = NUM_DISCARD_REASONS;
114 if (upload_succeeded) { 116 if (upload_succeeded) {
115 reason = UPLOAD_SUCCESS; 117 reason = UPLOAD_SUCCESS;
(...skipping 24 matching lines...) Expand all
140 if (!server_is_healthy) 142 if (!server_is_healthy)
141 upload_interval_ = BackOffUploadInterval(upload_interval_); 143 upload_interval_ = BackOffUploadInterval(upload_interval_);
142 else 144 else
143 upload_interval_ = base::TimeDelta::FromSeconds(kUnsentLogsIntervalSeconds); 145 upload_interval_ = base::TimeDelta::FromSeconds(kUnsentLogsIntervalSeconds);
144 146
145 if (more_logs_remaining) 147 if (more_logs_remaining)
146 ScheduleNextUpload(upload_interval_); 148 ScheduleNextUpload(upload_interval_);
147 } 149 }
148 150
149 } // namespace rappor 151 } // namespace rappor
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698