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

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

Issue 1551433002: Switch to standard integer types in components/, part 3 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 4 years, 12 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
« no previous file with comments | « components/rappor/byte_vector_utils.h ('k') | components/rappor/log_uploader_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/rappor/log_uploader.h" 5 #include "components/rappor/log_uploader.h"
6 6
7 #include <stddef.h>
8 #include <stdint.h>
9
7 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
8 #include "base/metrics/sparse_histogram.h" 11 #include "base/metrics/sparse_histogram.h"
9 #include "components/data_use_measurement/core/data_use_user_data.h" 12 #include "components/data_use_measurement/core/data_use_user_data.h"
10 #include "net/base/load_flags.h" 13 #include "net/base/load_flags.h"
11 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
12 #include "net/url_request/url_fetcher.h" 15 #include "net/url_request/url_fetcher.h"
13 16
14 namespace { 17 namespace {
15 18
16 // The delay, in seconds, between uploading when there are queued logs to send. 19 // The delay, in seconds, between uploading when there are queued logs to send.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // We already drop cookies server-side, but we might as well strip them out 122 // We already drop cookies server-side, but we might as well strip them out
120 // client-side as well. 123 // client-side as well.
121 current_fetch_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | 124 current_fetch_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES |
122 net::LOAD_DO_NOT_SEND_COOKIES); 125 net::LOAD_DO_NOT_SEND_COOKIES);
123 current_fetch_->Start(); 126 current_fetch_->Start();
124 } 127 }
125 128
126 // static 129 // static
127 base::TimeDelta LogUploader::BackOffUploadInterval(base::TimeDelta interval) { 130 base::TimeDelta LogUploader::BackOffUploadInterval(base::TimeDelta interval) {
128 DCHECK_GT(kBackoffMultiplier, 1.0); 131 DCHECK_GT(kBackoffMultiplier, 1.0);
129 interval = base::TimeDelta::FromMicroseconds(static_cast<int64>( 132 interval = base::TimeDelta::FromMicroseconds(
130 kBackoffMultiplier * interval.InMicroseconds())); 133 static_cast<int64_t>(kBackoffMultiplier * interval.InMicroseconds()));
131 134
132 base::TimeDelta max_interval = 135 base::TimeDelta max_interval =
133 base::TimeDelta::FromSeconds(kMaxBackoffIntervalSeconds); 136 base::TimeDelta::FromSeconds(kMaxBackoffIntervalSeconds);
134 return interval > max_interval ? max_interval : interval; 137 return interval > max_interval ? max_interval : interval;
135 } 138 }
136 139
137 void LogUploader::OnURLFetchComplete(const net::URLFetcher* source) { 140 void LogUploader::OnURLFetchComplete(const net::URLFetcher* source) {
138 // We're not allowed to re-use the existing |URLFetcher|s, so free them here. 141 // We're not allowed to re-use the existing |URLFetcher|s, so free them here.
139 // Note however that |source| is aliased to the fetcher, so we should be 142 // Note however that |source| is aliased to the fetcher, so we should be
140 // careful not to delete it too early. 143 // careful not to delete it too early.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 if (!server_is_healthy) 192 if (!server_is_healthy)
190 upload_interval_ = BackOffUploadInterval(upload_interval_); 193 upload_interval_ = BackOffUploadInterval(upload_interval_);
191 else 194 else
192 upload_interval_ = base::TimeDelta::FromSeconds(kUnsentLogsIntervalSeconds); 195 upload_interval_ = base::TimeDelta::FromSeconds(kUnsentLogsIntervalSeconds);
193 196
194 if (CanStartUpload()) 197 if (CanStartUpload())
195 ScheduleNextUpload(upload_interval_); 198 ScheduleNextUpload(upload_interval_);
196 } 199 }
197 200
198 } // namespace rappor 201 } // namespace rappor
OLDNEW
« no previous file with comments | « components/rappor/byte_vector_utils.h ('k') | components/rappor/log_uploader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698