OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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::TrialExists("ConnnectBackupJobs"); | 137 base::FieldTrialList::Find("ConnnectBackupJobs") && |
| 138 !base::FieldTrialList::Find("ConnnectBackupJobs")->group_name().empty(); |
138 if (connect_backup_jobs_fieldtrial) { | 139 if (connect_backup_jobs_fieldtrial) { |
139 UMA_HISTOGRAM_ENUMERATION( | 140 UMA_HISTOGRAM_ENUMERATION( |
140 base::FieldTrial::MakeName("Net.PreconnectUtilization2", | 141 base::FieldTrial::MakeName("Net.PreconnectUtilization2", |
141 "ConnnectBackupJobs"), | 142 "ConnnectBackupJobs"), |
142 result, 9); | 143 result, 9); |
143 } | 144 } |
144 } | 145 } |
145 | 146 |
146 void StreamSocket::LogByteTransfer(const BoundNetLog& net_log, | 147 void StreamSocket::LogByteTransfer(const BoundNetLog& net_log, |
147 NetLog::EventType event_type, | 148 NetLog::EventType event_type, |
148 int byte_count, | 149 int byte_count, |
149 char* bytes) const { | 150 char* bytes) const { |
150 scoped_refptr<NetLog::EventParameters> params; | 151 scoped_refptr<NetLog::EventParameters> params; |
151 if (net_log.IsLoggingBytes()) { | 152 if (net_log.IsLoggingBytes()) { |
152 params = new NetLogBytesTransferredParameter(byte_count, bytes); | 153 params = new NetLogBytesTransferredParameter(byte_count, bytes); |
153 } else { | 154 } else { |
154 params = new NetLogBytesTransferredParameter(byte_count, NULL); | 155 params = new NetLogBytesTransferredParameter(byte_count, NULL); |
155 } | 156 } |
156 net_log.AddEvent(event_type, params); | 157 net_log.AddEvent(event_type, params); |
157 } | 158 } |
158 | 159 |
159 } // namespace net | 160 } // namespace net |
OLD | NEW |