| 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/alias.h" | 12 #include "base/debug/alias.h" |
| 13 #include "base/debug/dump_without_crashing.h" | 13 #include "base/debug/dump_without_crashing.h" |
| 14 #include "base/debug/stack_trace.h" | 14 #include "base/debug/stack_trace.h" |
| 15 #include "base/debug/trace_event.h" | 15 #include "base/debug/trace_event.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
| 18 #include "base/metrics/user_metrics.h" | 18 #include "base/metrics/user_metrics.h" |
| 19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
| 20 #include "base/prefs/pref_member.h" | 20 #include "base/prefs/pref_member.h" |
| 21 #include "base/prefs/pref_service.h" | 21 #include "base/prefs/pref_service.h" |
| 22 #include "base/profiler/scoped_tracker.h" |
| 22 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
| 23 #include "base/time/time.h" | 24 #include "base/time/time.h" |
| 24 #include "chrome/browser/browser_process.h" | 25 #include "chrome/browser/browser_process.h" |
| 25 #include "chrome/browser/content_settings/cookie_settings.h" | 26 #include "chrome/browser/content_settings/cookie_settings.h" |
| 26 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 27 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 27 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 28 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 28 #include "chrome/browser/net/chrome_extensions_network_delegate.h" | 29 #include "chrome/browser/net/chrome_extensions_network_delegate.h" |
| 29 #include "chrome/browser/net/client_hints.h" | 30 #include "chrome/browser/net/client_hints.h" |
| 30 #include "chrome/browser/net/connect_interceptor.h" | 31 #include "chrome/browser/net/connect_interceptor.h" |
| 31 #include "chrome/browser/net/safe_search_util.h" | 32 #include "chrome/browser/net/safe_search_util.h" |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 } | 522 } |
| 522 | 523 |
| 523 | 524 |
| 524 void ChromeNetworkDelegate::OnResponseStarted(net::URLRequest* request) { | 525 void ChromeNetworkDelegate::OnResponseStarted(net::URLRequest* request) { |
| 525 TRACE_EVENT_ASYNC_STEP_PAST0("net", "URLRequest", request, "ResponseStarted"); | 526 TRACE_EVENT_ASYNC_STEP_PAST0("net", "URLRequest", request, "ResponseStarted"); |
| 526 extensions_delegate_->OnResponseStarted(request); | 527 extensions_delegate_->OnResponseStarted(request); |
| 527 } | 528 } |
| 528 | 529 |
| 529 void ChromeNetworkDelegate::OnRawBytesRead(const net::URLRequest& request, | 530 void ChromeNetworkDelegate::OnRawBytesRead(const net::URLRequest& request, |
| 530 int bytes_read) { | 531 int bytes_read) { |
| 532 // TODO(vadimt): Remove ScopedTracker below once crbug.com/423948 is fixed. |
| 533 tracked_objects::ScopedTracker tracking_profile( |
| 534 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 535 "423948 ChromeNetworkDelegate::OnRawBytesRead")); |
| 536 |
| 531 TRACE_EVENT_ASYNC_STEP_PAST1("net", "URLRequest", &request, "DidRead", | 537 TRACE_EVENT_ASYNC_STEP_PAST1("net", "URLRequest", &request, "DidRead", |
| 532 "bytes_read", bytes_read); | 538 "bytes_read", bytes_read); |
| 533 #if defined(ENABLE_TASK_MANAGER) | 539 #if defined(ENABLE_TASK_MANAGER) |
| 534 // This is not completely accurate, but as a first approximation ignore | 540 // This is not completely accurate, but as a first approximation ignore |
| 535 // requests that are served from the cache. See bug 330931 for more info. | 541 // requests that are served from the cache. See bug 330931 for more info. |
| 536 if (!request.was_cached()) | 542 if (!request.was_cached()) |
| 537 TaskManager::GetInstance()->model()->NotifyBytesRead(request, bytes_read); | 543 TaskManager::GetInstance()->model()->NotifyBytesRead(request, bytes_read); |
| 538 #endif // defined(ENABLE_TASK_MANAGER) | 544 #endif // defined(ENABLE_TASK_MANAGER) |
| 539 } | 545 } |
| 540 | 546 |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 if (data_reduction_proxy_statistics_prefs_) { | 830 if (data_reduction_proxy_statistics_prefs_) { |
| 825 StoreAccumulatedContentLength(received_content_length, | 831 StoreAccumulatedContentLength(received_content_length, |
| 826 original_content_length, | 832 original_content_length, |
| 827 request_type, | 833 request_type, |
| 828 reinterpret_cast<Profile*>(profile_), | 834 reinterpret_cast<Profile*>(profile_), |
| 829 data_reduction_proxy_statistics_prefs_); | 835 data_reduction_proxy_statistics_prefs_); |
| 830 } | 836 } |
| 831 received_content_length_ += received_content_length; | 837 received_content_length_ += received_content_length; |
| 832 original_content_length_ += original_content_length; | 838 original_content_length_ += original_content_length; |
| 833 } | 839 } |
| OLD | NEW |