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

Side by Side Diff: components/data_use_measurement/core/data_use_measurement.h

Issue 2851923002: Fix overflow in user traffic content type histogram (Closed)
Patch Set: Created 3 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef COMPONENTS_DATA_USE_MEASUREMENT_CONTENT_DATA_USE_MEASUREMENT_H_ 5 #ifndef COMPONENTS_DATA_USE_MEASUREMENT_CONTENT_DATA_USE_MEASUREMENT_H_
6 #define COMPONENTS_DATA_USE_MEASUREMENT_CONTENT_DATA_USE_MEASUREMENT_H_ 6 #define COMPONENTS_DATA_USE_MEASUREMENT_CONTENT_DATA_USE_MEASUREMENT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // ApplicationStatusListener used to monitor whether the application is in the 174 // ApplicationStatusListener used to monitor whether the application is in the
175 // foreground or in the background. It is owned by DataUseMeasurement. 175 // foreground or in the background. It is owned by DataUseMeasurement.
176 std::unique_ptr<base::android::ApplicationStatusListener> app_listener_; 176 std::unique_ptr<base::android::ApplicationStatusListener> app_listener_;
177 177
178 // Number of bytes received and sent by Chromium as reported by the operating 178 // Number of bytes received and sent by Chromium as reported by the operating
179 // system when it was last queried for traffic statistics. Set to 0 if the 179 // system when it was last queried for traffic statistics. Set to 0 if the
180 // operating system was never queried. 180 // operating system was never queried.
181 int64_t rx_bytes_os_; 181 int64_t rx_bytes_os_;
182 int64_t tx_bytes_os_; 182 int64_t tx_bytes_os_;
183 183
184 // User traffic data use by content type is logged in 1KB increments. The
185 // remaining bytes are saved in this array until logged next time.
186 int64_t user_traffic_content_type_bytes_[DataUseUserData::TYPE_MAX];
187
184 // Number of bytes received and sent by Chromium as reported by the network 188 // Number of bytes received and sent by Chromium as reported by the network
185 // delegate since the operating system was last queried for traffic 189 // delegate since the operating system was last queried for traffic
186 // statistics. 190 // statistics.
187 int64_t bytes_transferred_since_last_traffic_stats_query_; 191 int64_t bytes_transferred_since_last_traffic_stats_query_;
188 192
189 // The time at which Chromium app state changed to background. Can be null if 193 // The time at which Chromium app state changed to background. Can be null if
190 // app is not in background. 194 // app is not in background.
191 base::TimeTicks last_app_background_time_; 195 base::TimeTicks last_app_background_time_;
192 196
193 // True if app is in background and first network read has not yet happened. 197 // True if app is in background and first network read has not yet happened.
194 bool no_reads_since_background_; 198 bool no_reads_since_background_;
195 #endif 199 #endif
196 200
197 DISALLOW_COPY_AND_ASSIGN(DataUseMeasurement); 201 DISALLOW_COPY_AND_ASSIGN(DataUseMeasurement);
198 }; 202 };
199 203
200 } // namespace data_use_measurement 204 } // namespace data_use_measurement
201 205
202 #endif // COMPONENTS_DATA_USE_MEASUREMENT_CONTENT_DATA_USE_MEASUREMENT_H_ 206 #endif // COMPONENTS_DATA_USE_MEASUREMENT_CONTENT_DATA_USE_MEASUREMENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698