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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
6 | 6 |
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/bind_helpers.h" | 14 #include "base/bind_helpers.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
17 #include "base/debug/alias.h" | 17 #include "base/debug/alias.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
20 #include "base/memory/shared_memory.h" | 20 #include "base/memory/shared_memory.h" |
21 #include "base/message_loop/message_loop.h" | 21 #include "base/message_loop/message_loop.h" |
22 #include "base/metrics/histogram.h" | 22 #include "base/metrics/histogram.h" |
23 #include "base/metrics/sparse_histogram.h" | 23 #include "base/metrics/sparse_histogram.h" |
24 #include "base/profiler/scoped_tracker.h" | 24 #include "base/profiler/scoped_tracker.h" |
25 #include "base/stl_util.h" | 25 #include "base/stl_util.h" |
26 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 26 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| 27 #include "base/time/time.h" |
27 #include "content/browser/appcache/appcache_interceptor.h" | 28 #include "content/browser/appcache/appcache_interceptor.h" |
28 #include "content/browser/appcache/chrome_appcache_service.h" | 29 #include "content/browser/appcache/chrome_appcache_service.h" |
29 #include "content/browser/cert_store_impl.h" | 30 #include "content/browser/cert_store_impl.h" |
30 #include "content/browser/child_process_security_policy_impl.h" | 31 #include "content/browser/child_process_security_policy_impl.h" |
31 #include "content/browser/download/download_resource_handler.h" | 32 #include "content/browser/download/download_resource_handler.h" |
32 #include "content/browser/download/save_file_manager.h" | 33 #include "content/browser/download/save_file_manager.h" |
33 #include "content/browser/download/save_file_resource_handler.h" | 34 #include "content/browser/download/save_file_resource_handler.h" |
34 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 35 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
35 #include "content/browser/frame_host/navigation_request_info.h" | 36 #include "content/browser/frame_host/navigation_request_info.h" |
36 #include "content/browser/frame_host/navigator.h" | 37 #include "content/browser/frame_host/navigator.h" |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 ResourceRequestInfo* info = loader->GetRequestInfo(); | 856 ResourceRequestInfo* info = loader->GetRequestInfo(); |
856 | 857 |
857 // Record final result of all resource loads. | 858 // Record final result of all resource loads. |
858 if (info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME) { | 859 if (info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME) { |
859 // This enumeration has "3" appended to its name to distinguish it from | 860 // This enumeration has "3" appended to its name to distinguish it from |
860 // older versions. | 861 // older versions. |
861 UMA_HISTOGRAM_SPARSE_SLOWLY( | 862 UMA_HISTOGRAM_SPARSE_SLOWLY( |
862 "Net.ErrorCodesForMainFrame3", | 863 "Net.ErrorCodesForMainFrame3", |
863 -loader->request()->status().error()); | 864 -loader->request()->status().error()); |
864 | 865 |
| 866 // Record time to success and error for the most common errors, and for |
| 867 // the aggregate remainder errors. |
| 868 base::TimeDelta request_loading_time( |
| 869 base::Time::Now() - loader->request()->request_time()); |
| 870 switch (loader->request()->status().error()) { |
| 871 case net::OK: |
| 872 UMA_HISTOGRAM_LONG_TIMES( |
| 873 "Net.RequestTime.Success", request_loading_time); |
| 874 break; |
| 875 case net::ERR_ABORTED: |
| 876 UMA_HISTOGRAM_LONG_TIMES( |
| 877 "Net.RequestTime.ErrAborted", request_loading_time); |
| 878 break; |
| 879 case net::ERR_CONNECTION_RESET: |
| 880 UMA_HISTOGRAM_LONG_TIMES( |
| 881 "Net.RequestTime.ErrConnectionReset", request_loading_time); |
| 882 break; |
| 883 case net::ERR_CONNECTION_TIMED_OUT: |
| 884 UMA_HISTOGRAM_LONG_TIMES( |
| 885 "Net.RequestTime.ErrConnectionTimedOut", request_loading_time); |
| 886 break; |
| 887 case net::ERR_INTERNET_DISCONNECTED: |
| 888 UMA_HISTOGRAM_LONG_TIMES( |
| 889 "Net.RequestTime.ErrInternetDisconnected", request_loading_time); |
| 890 break; |
| 891 case net::ERR_NAME_NOT_RESOLVED: |
| 892 UMA_HISTOGRAM_LONG_TIMES( |
| 893 "Net.RequestTime.ErrNameNotResolved", request_loading_time); |
| 894 break; |
| 895 case net::ERR_TIMED_OUT: |
| 896 UMA_HISTOGRAM_LONG_TIMES( |
| 897 "Net.RequestTime.ErrTimedOut", request_loading_time); |
| 898 break; |
| 899 default: |
| 900 UMA_HISTOGRAM_LONG_TIMES( |
| 901 "Net.RequestTime.MiscError", request_loading_time); |
| 902 break; |
| 903 } |
| 904 |
865 if (loader->request()->url().SchemeIsCryptographic()) { | 905 if (loader->request()->url().SchemeIsCryptographic()) { |
866 if (loader->request()->url().host() == "www.google.com") { | 906 if (loader->request()->url().host() == "www.google.com") { |
867 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.ErrorCodesForHTTPSGoogleMainFrame2", | 907 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.ErrorCodesForHTTPSGoogleMainFrame2", |
868 -loader->request()->status().error()); | 908 -loader->request()->status().error()); |
869 } | 909 } |
870 | 910 |
871 int num_valid_scts = std::count_if( | 911 int num_valid_scts = std::count_if( |
872 loader->request()->ssl_info().signed_certificate_timestamps.begin(), | 912 loader->request()->ssl_info().signed_certificate_timestamps.begin(), |
873 loader->request()->ssl_info().signed_certificate_timestamps.end(), | 913 loader->request()->ssl_info().signed_certificate_timestamps.end(), |
874 IsValidatedSCT); | 914 IsValidatedSCT); |
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2345 | 2385 |
2346 // Add a flag to selectively bypass the data reduction proxy if the resource | 2386 // Add a flag to selectively bypass the data reduction proxy if the resource |
2347 // type is not an image. | 2387 // type is not an image. |
2348 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) | 2388 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) |
2349 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; | 2389 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; |
2350 | 2390 |
2351 return load_flags; | 2391 return load_flags; |
2352 } | 2392 } |
2353 | 2393 |
2354 } // namespace content | 2394 } // namespace content |
OLD | NEW |