OLD | NEW |
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 <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 } | 531 } |
532 | 532 |
533 void ChromeNetworkDelegate::OnRawBytesRead(const net::URLRequest& request, | 533 void ChromeNetworkDelegate::OnRawBytesRead(const net::URLRequest& request, |
534 int bytes_read) { | 534 int bytes_read) { |
535 TRACE_EVENT_ASYNC_STEP_PAST1("net", "URLRequest", &request, "DidRead", | 535 TRACE_EVENT_ASYNC_STEP_PAST1("net", "URLRequest", &request, "DidRead", |
536 "bytes_read", bytes_read); | 536 "bytes_read", bytes_read); |
537 performance_monitor::PerformanceMonitor::GetInstance()->BytesReadOnIOThread( | 537 performance_monitor::PerformanceMonitor::GetInstance()->BytesReadOnIOThread( |
538 request, bytes_read); | 538 request, bytes_read); |
539 | 539 |
540 #if defined(ENABLE_TASK_MANAGER) | 540 #if defined(ENABLE_TASK_MANAGER) |
541 TaskManager::GetInstance()->model()->NotifyBytesRead(request, bytes_read); | 541 // This is not completely accurate, but as a first approximation ignore |
| 542 // requests that are served from the cache. See bug 330931 for more info. |
| 543 if (!request.was_cached()) |
| 544 TaskManager::GetInstance()->model()->NotifyBytesRead(request, bytes_read); |
542 #endif // defined(ENABLE_TASK_MANAGER) | 545 #endif // defined(ENABLE_TASK_MANAGER) |
543 } | 546 } |
544 | 547 |
545 void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request, | 548 void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request, |
546 bool started) { | 549 bool started) { |
547 TRACE_EVENT_ASYNC_END0("net", "URLRequest", request); | 550 TRACE_EVENT_ASYNC_END0("net", "URLRequest", request); |
548 if (request->status().status() == net::URLRequestStatus::SUCCESS) { | 551 if (request->status().status() == net::URLRequestStatus::SUCCESS) { |
549 // For better accuracy, we use the actual bytes read instead of the length | 552 // For better accuracy, we use the actual bytes read instead of the length |
550 // specified with the Content-Length header, which may be inaccurate, | 553 // specified with the Content-Length header, which may be inaccurate, |
551 // or missing, as is the case with chunked encoding. | 554 // or missing, as is the case with chunked encoding. |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 spdyproxy::DataReductionRequestType data_reduction_type) { | 803 spdyproxy::DataReductionRequestType data_reduction_type) { |
801 DCHECK_GE(received_content_length, 0); | 804 DCHECK_GE(received_content_length, 0); |
802 DCHECK_GE(original_content_length, 0); | 805 DCHECK_GE(original_content_length, 0); |
803 StoreAccumulatedContentLength(received_content_length, | 806 StoreAccumulatedContentLength(received_content_length, |
804 original_content_length, | 807 original_content_length, |
805 data_reduction_type, | 808 data_reduction_type, |
806 reinterpret_cast<Profile*>(profile_)); | 809 reinterpret_cast<Profile*>(profile_)); |
807 received_content_length_ += received_content_length; | 810 received_content_length_ += received_content_length; |
808 original_content_length_ += original_content_length; | 811 original_content_length_ += original_content_length; |
809 } | 812 } |
OLD | NEW |