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 |
11 #include "base/base_paths.h" | 11 #include "base/base_paths.h" |
12 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/prefs/pref_member.h" | 16 #include "base/prefs/pref_member.h" |
17 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/content_settings/cookie_settings.h" | 21 #include "chrome/browser/content_settings/cookie_settings.h" |
22 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 22 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
23 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 23 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
24 #include "chrome/browser/net/chrome_extensions_network_delegate.h" | 24 #include "chrome/browser/net/chrome_extensions_network_delegate.h" |
25 #include "chrome/browser/net/client_hints.h" | 25 #include "chrome/browser/net/client_hints.h" |
26 #include "chrome/browser/net/connect_interceptor.h" | 26 #include "chrome/browser/net/connect_interceptor.h" |
27 #include "chrome/browser/net/safe_search_util.h" | 27 #include "chrome/browser/net/safe_search_util.h" |
28 #include "chrome/browser/performance_monitor/performance_monitor.h" | |
29 #include "chrome/browser/prerender/prerender_tracker.h" | 28 #include "chrome/browser/prerender/prerender_tracker.h" |
30 #include "chrome/browser/profiles/profile_manager.h" | 29 #include "chrome/browser/profiles/profile_manager.h" |
31 #include "chrome/browser/task_manager/task_manager.h" | 30 #include "chrome/browser/task_manager/task_manager.h" |
32 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
33 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ
est_handler.h" | 32 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ
est_handler.h" |
34 #include "components/data_reduction_proxy/browser/data_reduction_proxy_metrics.h
" | 33 #include "components/data_reduction_proxy/browser/data_reduction_proxy_metrics.h
" |
35 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" | 34 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" |
36 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol.
h" | 35 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol.
h" |
37 #include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_sta
ts.h" | 36 #include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_sta
ts.h" |
38 #include "components/domain_reliability/monitor.h" | 37 #include "components/domain_reliability/monitor.h" |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 | 514 |
516 void ChromeNetworkDelegate::OnResponseStarted(net::URLRequest* request) { | 515 void ChromeNetworkDelegate::OnResponseStarted(net::URLRequest* request) { |
517 TRACE_EVENT_ASYNC_STEP_PAST0("net", "URLRequest", request, "ResponseStarted"); | 516 TRACE_EVENT_ASYNC_STEP_PAST0("net", "URLRequest", request, "ResponseStarted"); |
518 extensions_delegate_->OnResponseStarted(request); | 517 extensions_delegate_->OnResponseStarted(request); |
519 } | 518 } |
520 | 519 |
521 void ChromeNetworkDelegate::OnRawBytesRead(const net::URLRequest& request, | 520 void ChromeNetworkDelegate::OnRawBytesRead(const net::URLRequest& request, |
522 int bytes_read) { | 521 int bytes_read) { |
523 TRACE_EVENT_ASYNC_STEP_PAST1("net", "URLRequest", &request, "DidRead", | 522 TRACE_EVENT_ASYNC_STEP_PAST1("net", "URLRequest", &request, "DidRead", |
524 "bytes_read", bytes_read); | 523 "bytes_read", bytes_read); |
525 performance_monitor::PerformanceMonitor::GetInstance()->BytesReadOnIOThread( | |
526 request, bytes_read); | |
527 | |
528 #if defined(ENABLE_TASK_MANAGER) | 524 #if defined(ENABLE_TASK_MANAGER) |
529 // This is not completely accurate, but as a first approximation ignore | 525 // This is not completely accurate, but as a first approximation ignore |
530 // requests that are served from the cache. See bug 330931 for more info. | 526 // requests that are served from the cache. See bug 330931 for more info. |
531 if (!request.was_cached()) | 527 if (!request.was_cached()) |
532 TaskManager::GetInstance()->model()->NotifyBytesRead(request, bytes_read); | 528 TaskManager::GetInstance()->model()->NotifyBytesRead(request, bytes_read); |
533 #endif // defined(ENABLE_TASK_MANAGER) | 529 #endif // defined(ENABLE_TASK_MANAGER) |
534 } | 530 } |
535 | 531 |
536 void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request, | 532 void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request, |
537 bool started) { | 533 bool started) { |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 data_reduction_proxy::DataReductionProxyRequestType request_type) { | 817 data_reduction_proxy::DataReductionProxyRequestType request_type) { |
822 DCHECK_GE(received_content_length, 0); | 818 DCHECK_GE(received_content_length, 0); |
823 DCHECK_GE(original_content_length, 0); | 819 DCHECK_GE(original_content_length, 0); |
824 StoreAccumulatedContentLength(received_content_length, | 820 StoreAccumulatedContentLength(received_content_length, |
825 original_content_length, | 821 original_content_length, |
826 request_type, | 822 request_type, |
827 reinterpret_cast<Profile*>(profile_)); | 823 reinterpret_cast<Profile*>(profile_)); |
828 received_content_length_ += received_content_length; | 824 received_content_length_ += received_content_length; |
829 original_content_length_ += original_content_length; | 825 original_content_length_ += original_content_length; |
830 } | 826 } |
OLD | NEW |