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

Side by Side Diff: net/http/http_cache_transaction.cc

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « net/http/disk_cache_based_quic_server_info.cc ('k') | net/http/http_network_session.h » ('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 "net/http/http_cache_transaction.h" 5 #include "net/http/http_cache_transaction.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_POSIX) 9 #if defined(OS_POSIX)
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 2865 matching lines...) Expand 10 before | Expand all | Expand 10 after
2876 transaction_pattern_ == PATTERN_ENTRY_CANT_CONDITIONALIZE)) || 2876 transaction_pattern_ == PATTERN_ENTRY_CANT_CONDITIONALIZE)) ||
2877 (!did_send_request && transaction_pattern_ == PATTERN_ENTRY_USED)); 2877 (!did_send_request && transaction_pattern_ == PATTERN_ENTRY_USED));
2878 2878
2879 if (!did_send_request) { 2879 if (!did_send_request) {
2880 DCHECK(transaction_pattern_ == PATTERN_ENTRY_USED); 2880 DCHECK(transaction_pattern_ == PATTERN_ENTRY_USED);
2881 UMA_HISTOGRAM_TIMES("HttpCache.AccessToDone.Used", total_time); 2881 UMA_HISTOGRAM_TIMES("HttpCache.AccessToDone.Used", total_time);
2882 return; 2882 return;
2883 } 2883 }
2884 2884
2885 TimeDelta before_send_time = send_request_since_ - first_cache_access_since_; 2885 TimeDelta before_send_time = send_request_since_ - first_cache_access_since_;
2886 int before_send_percent = 2886 int64 before_send_percent = (total_time.ToInternalValue() == 0) ?
2887 total_time.ToInternalValue() == 0 ? 0 2887 0 : before_send_time * 100 / total_time;
2888 : before_send_time * 100 / total_time; 2888 DCHECK_GE(before_send_percent, 0);
2889 DCHECK_LE(0, before_send_percent); 2889 DCHECK_LE(before_send_percent, 100);
2890 DCHECK_GE(100, before_send_percent); 2890 base::HistogramBase::Sample before_send_sample =
2891 static_cast<base::HistogramBase::Sample>(before_send_percent);
2891 2892
2892 UMA_HISTOGRAM_TIMES("HttpCache.AccessToDone.SentRequest", total_time); 2893 UMA_HISTOGRAM_TIMES("HttpCache.AccessToDone.SentRequest", total_time);
2893 UMA_HISTOGRAM_TIMES("HttpCache.BeforeSend", before_send_time); 2894 UMA_HISTOGRAM_TIMES("HttpCache.BeforeSend", before_send_time);
2894 UMA_HISTOGRAM_PERCENTAGE("HttpCache.PercentBeforeSend", before_send_percent); 2895 UMA_HISTOGRAM_PERCENTAGE("HttpCache.PercentBeforeSend", before_send_sample);
2895 2896
2896 // TODO(gavinp): Remove or minimize these histograms, particularly the ones 2897 // TODO(gavinp): Remove or minimize these histograms, particularly the ones
2897 // below this comment after we have received initial data. 2898 // below this comment after we have received initial data.
2898 switch (transaction_pattern_) { 2899 switch (transaction_pattern_) {
2899 case PATTERN_ENTRY_CANT_CONDITIONALIZE: { 2900 case PATTERN_ENTRY_CANT_CONDITIONALIZE: {
2900 UMA_HISTOGRAM_TIMES("HttpCache.BeforeSend.CantConditionalize", 2901 UMA_HISTOGRAM_TIMES("HttpCache.BeforeSend.CantConditionalize",
2901 before_send_time); 2902 before_send_time);
2902 UMA_HISTOGRAM_PERCENTAGE("HttpCache.PercentBeforeSend.CantConditionalize", 2903 UMA_HISTOGRAM_PERCENTAGE("HttpCache.PercentBeforeSend.CantConditionalize",
2903 before_send_percent); 2904 before_send_sample);
2904 break; 2905 break;
2905 } 2906 }
2906 case PATTERN_ENTRY_NOT_CACHED: { 2907 case PATTERN_ENTRY_NOT_CACHED: {
2907 UMA_HISTOGRAM_TIMES("HttpCache.BeforeSend.NotCached", before_send_time); 2908 UMA_HISTOGRAM_TIMES("HttpCache.BeforeSend.NotCached", before_send_time);
2908 UMA_HISTOGRAM_PERCENTAGE("HttpCache.PercentBeforeSend.NotCached", 2909 UMA_HISTOGRAM_PERCENTAGE("HttpCache.PercentBeforeSend.NotCached",
2909 before_send_percent); 2910 before_send_sample);
2910 break; 2911 break;
2911 } 2912 }
2912 case PATTERN_ENTRY_VALIDATED: { 2913 case PATTERN_ENTRY_VALIDATED: {
2913 UMA_HISTOGRAM_TIMES("HttpCache.BeforeSend.Validated", before_send_time); 2914 UMA_HISTOGRAM_TIMES("HttpCache.BeforeSend.Validated", before_send_time);
2914 UMA_HISTOGRAM_PERCENTAGE("HttpCache.PercentBeforeSend.Validated", 2915 UMA_HISTOGRAM_PERCENTAGE("HttpCache.PercentBeforeSend.Validated",
2915 before_send_percent); 2916 before_send_sample);
2916 break; 2917 break;
2917 } 2918 }
2918 case PATTERN_ENTRY_UPDATED: { 2919 case PATTERN_ENTRY_UPDATED: {
2919 UMA_HISTOGRAM_TIMES("HttpCache.BeforeSend.Updated", before_send_time); 2920 UMA_HISTOGRAM_TIMES("HttpCache.BeforeSend.Updated", before_send_time);
2920 UMA_HISTOGRAM_PERCENTAGE("HttpCache.PercentBeforeSend.Updated", 2921 UMA_HISTOGRAM_PERCENTAGE("HttpCache.PercentBeforeSend.Updated",
2921 before_send_percent); 2922 before_send_sample);
2922 break; 2923 break;
2923 } 2924 }
2924 default: 2925 default:
2925 NOTREACHED(); 2926 NOTREACHED();
2926 } 2927 }
2927 } 2928 }
2928 2929
2929 void HttpCache::Transaction::OnIOComplete(int result) { 2930 void HttpCache::Transaction::OnIOComplete(int result) {
2930 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. 2931 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed.
2931 tracked_objects::ScopedTracker tracking_profile( 2932 tracked_objects::ScopedTracker tracking_profile(
2932 FROM_HERE_WITH_EXPLICIT_FUNCTION("422516 Transaction::OnIOComplete")); 2933 FROM_HERE_WITH_EXPLICIT_FUNCTION("422516 Transaction::OnIOComplete"));
2933 2934
2934 DoLoop(result); 2935 DoLoop(result);
2935 } 2936 }
2936 2937
2937 } // namespace net 2938 } // namespace net
OLDNEW
« no previous file with comments | « net/http/disk_cache_based_quic_server_info.cc ('k') | net/http/http_network_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698