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

Side by Side Diff: chrome/browser/net/chrome_network_delegate.cc

Issue 2338563003: Record UMA for total data usage consumed by Chromium (Closed)
Patch Set: rebased, addressed gayane comment 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
« no previous file with comments | « no previous file | chrome/browser/net/chrome_network_delegate_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/net/chrome_network_delegate.h" 5 #include "chrome/browser/net/chrome_network_delegate.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 357
358 void ChromeNetworkDelegate::OnNetworkBytesReceived(net::URLRequest* request, 358 void ChromeNetworkDelegate::OnNetworkBytesReceived(net::URLRequest* request,
359 int64_t bytes_received) { 359 int64_t bytes_received) {
360 #if defined(ENABLE_TASK_MANAGER) 360 #if defined(ENABLE_TASK_MANAGER)
361 // Note: Currently, OnNetworkBytesReceived is only implemented for HTTP jobs, 361 // Note: Currently, OnNetworkBytesReceived is only implemented for HTTP jobs,
362 // not FTP or other types, so those kinds of bytes will not be reported here. 362 // not FTP or other types, so those kinds of bytes will not be reported here.
363 task_manager::TaskManagerInterface::OnRawBytesRead(*request, bytes_received); 363 task_manager::TaskManagerInterface::OnRawBytesRead(*request, bytes_received);
364 #endif // defined(ENABLE_TASK_MANAGER) 364 #endif // defined(ENABLE_TASK_MANAGER)
365 365
366 ReportDataUsageStats(request, 0 /* tx_bytes */, bytes_received); 366 ReportDataUsageStats(request, 0 /* tx_bytes */, bytes_received);
367 data_use_measurement_.OnNetworkBytesReceived(*request, bytes_received);
367 } 368 }
368 369
369 void ChromeNetworkDelegate::OnNetworkBytesSent(net::URLRequest* request, 370 void ChromeNetworkDelegate::OnNetworkBytesSent(net::URLRequest* request,
370 int64_t bytes_sent) { 371 int64_t bytes_sent) {
371 ReportDataUsageStats(request, bytes_sent, 0 /* rx_bytes */); 372 ReportDataUsageStats(request, bytes_sent, 0 /* rx_bytes */);
373 data_use_measurement_.OnNetworkBytesSent(*request, bytes_sent);
372 } 374 }
373 375
374 void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request, 376 void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request,
375 bool started) { 377 bool started) {
376 data_use_measurement_.OnCompleted(*request, started); 378 data_use_measurement_.OnCompleted(*request, started);
377 RecordNetworkErrorHistograms(request); 379 RecordNetworkErrorHistograms(request);
378 380
379 if (request->status().status() == net::URLRequestStatus::SUCCESS) { 381 if (request->status().status() == net::URLRequestStatus::SUCCESS) {
380 #if BUILDFLAG(ANDROID_JAVA_UI) 382 #if BUILDFLAG(ANDROID_JAVA_UI)
381 precache::UpdatePrecacheMetricsAndState(request, profile_); 383 precache::UpdatePrecacheMetricsAndState(request, profile_);
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 if (!data_use_aggregator_) 587 if (!data_use_aggregator_)
586 return; 588 return;
587 589
588 if (is_data_usage_off_the_record_) { 590 if (is_data_usage_off_the_record_) {
589 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); 591 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes);
590 return; 592 return;
591 } 593 }
592 594
593 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); 595 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes);
594 } 596 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/net/chrome_network_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698