OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/socket/stream_socket.h" | 5 #include "net/socket/stream_socket.h" |
6 | 6 |
7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 | 11 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 else | 127 else |
128 result = 0; // Never used, and not really connected. | 128 result = 0; // Never used, and not really connected. |
129 | 129 |
130 if (omnibox_speculation_) | 130 if (omnibox_speculation_) |
131 result += 3; | 131 result += 3; |
132 else if (subresource_speculation_) | 132 else if (subresource_speculation_) |
133 result += 6; | 133 result += 6; |
134 UMA_HISTOGRAM_ENUMERATION("Net.PreconnectUtilization2", result, 9); | 134 UMA_HISTOGRAM_ENUMERATION("Net.PreconnectUtilization2", result, 9); |
135 | 135 |
136 static const bool connect_backup_jobs_fieldtrial = | 136 static const bool connect_backup_jobs_fieldtrial = |
137 base::FieldTrialList::Find("ConnnectBackupJobs") && | 137 base::FieldTrialList::TrialExists("ConnnectBackupJobs"); |
138 !base::FieldTrialList::Find("ConnnectBackupJobs")->group_name().empty(); | |
139 if (connect_backup_jobs_fieldtrial) { | 138 if (connect_backup_jobs_fieldtrial) { |
140 UMA_HISTOGRAM_ENUMERATION( | 139 UMA_HISTOGRAM_ENUMERATION( |
141 base::FieldTrial::MakeName("Net.PreconnectUtilization2", | 140 base::FieldTrial::MakeName("Net.PreconnectUtilization2", |
142 "ConnnectBackupJobs"), | 141 "ConnnectBackupJobs"), |
143 result, 9); | 142 result, 9); |
144 } | 143 } |
145 } | 144 } |
146 | 145 |
147 void StreamSocket::LogByteTransfer(const BoundNetLog& net_log, | 146 void StreamSocket::LogByteTransfer(const BoundNetLog& net_log, |
148 NetLog::EventType event_type, | 147 NetLog::EventType event_type, |
149 int byte_count, | 148 int byte_count, |
150 char* bytes) const { | 149 char* bytes) const { |
151 scoped_refptr<NetLog::EventParameters> params; | 150 scoped_refptr<NetLog::EventParameters> params; |
152 if (net_log.IsLoggingBytes()) { | 151 if (net_log.IsLoggingBytes()) { |
153 params = new NetLogBytesTransferredParameter(byte_count, bytes); | 152 params = new NetLogBytesTransferredParameter(byte_count, bytes); |
154 } else { | 153 } else { |
155 params = new NetLogBytesTransferredParameter(byte_count, NULL); | 154 params = new NetLogBytesTransferredParameter(byte_count, NULL); |
156 } | 155 } |
157 net_log.AddEvent(event_type, params); | 156 net_log.AddEvent(event_type, params); |
158 } | 157 } |
159 | 158 |
160 } // namespace net | 159 } // namespace net |
OLD | NEW |