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

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

Issue 1016873002: Record forced alternative service histogram. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months 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
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_server_properties_impl.h" 5 #include "net/http/http_server_properties_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/metrics/histogram.h"
11 #include "base/stl_util.h" 12 #include "base/stl_util.h"
12 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
13 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
14 15
15 namespace net { 16 namespace net {
16 17
17 namespace { 18 namespace {
18 19
19 const uint64 kBrokenAlternateProtocolDelaySecs = 300; 20 const uint64 kBrokenAlternateProtocolDelaySecs = 300;
20 21
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 } 239 }
239 240
240 AlternateProtocolInfo HttpServerPropertiesImpl::GetAlternateProtocol( 241 AlternateProtocolInfo HttpServerPropertiesImpl::GetAlternateProtocol(
241 const HostPortPair& server) { 242 const HostPortPair& server) {
242 AlternateProtocolMap::const_iterator it = 243 AlternateProtocolMap::const_iterator it =
243 GetAlternateProtocolIterator(server); 244 GetAlternateProtocolIterator(server);
244 if (it != alternate_protocol_map_.end() && 245 if (it != alternate_protocol_map_.end() &&
245 it->second.probability >= alternate_protocol_probability_threshold_) 246 it->second.probability >= alternate_protocol_probability_threshold_)
246 return it->second; 247 return it->second;
247 248
249 UMA_HISTOGRAM_BOOLEAN("Net.ForceAlternativeService",
250 g_forced_alternate_protocol);
248 if (g_forced_alternate_protocol) 251 if (g_forced_alternate_protocol)
249 return *g_forced_alternate_protocol; 252 return *g_forced_alternate_protocol;
250 253
251 AlternateProtocolInfo uninitialized_alternate_protocol; 254 AlternateProtocolInfo uninitialized_alternate_protocol;
252 return uninitialized_alternate_protocol; 255 return uninitialized_alternate_protocol;
253 } 256 }
254 257
255 void HttpServerPropertiesImpl::SetAlternateProtocol( 258 void HttpServerPropertiesImpl::SetAlternateProtocol(
256 const HostPortPair& server, 259 const HostPortPair& server,
257 uint16 alternate_port, 260 uint16 alternate_port,
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); 558 base::TimeDelta delay = when > now ? when - now : base::TimeDelta();
556 base::MessageLoop::current()->PostDelayedTask( 559 base::MessageLoop::current()->PostDelayedTask(
557 FROM_HERE, 560 FROM_HERE,
558 base::Bind( 561 base::Bind(
559 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, 562 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings,
560 weak_ptr_factory_.GetWeakPtr()), 563 weak_ptr_factory_.GetWeakPtr()),
561 delay); 564 delay);
562 } 565 }
563 566
564 } // namespace net 567 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698