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

Side by Side Diff: chrome/browser/net/dns_host_info.cc

Issue 462027: Use factory to create histograms, and refcounts to track lifetimes... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/browser/net/dns_host_info.h" 5 #include "chrome/browser/net/dns_host_info.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 state_ = old_prequeue_state_; 97 state_ = old_prequeue_state_;
98 DLogResultsStats("DNS Prefetch reset to prequeue"); 98 DLogResultsStats("DNS Prefetch reset to prequeue");
99 static const TimeDelta kBoundary = TimeDelta::FromSeconds(2); 99 static const TimeDelta kBoundary = TimeDelta::FromSeconds(2);
100 if (queue_duration_ > kBoundary) { 100 if (queue_duration_ > kBoundary) {
101 UMA_HISTOGRAM_MEDIUM_TIMES("DNS.QueueRecycledDeltaOver2", 101 UMA_HISTOGRAM_MEDIUM_TIMES("DNS.QueueRecycledDeltaOver2",
102 queue_duration_ - kBoundary); 102 queue_duration_ - kBoundary);
103 return; 103 return;
104 } 104 }
105 // Make a custom linear histogram for the region from 0 to boundary. 105 // Make a custom linear histogram for the region from 0 to boundary.
106 const size_t kBucketCount = 52; 106 const size_t kBucketCount = 52;
107 static LinearHistogram histogram("DNS.QueueRecycledUnder2", TimeDelta(), 107 static scoped_refptr<Histogram> histogram =
108 kBoundary, kBucketCount); 108 LinearHistogram::LinearHistogramFactoryGet("DNS.QueueRecycledUnder2",
109 histogram.SetFlags(kUmaTargetedHistogramFlag); 109 TimeDelta(), kBoundary, kBucketCount);
110 histogram.AddTime(queue_duration_); 110 histogram->SetFlags(kUmaTargetedHistogramFlag);
111 histogram->AddTime(queue_duration_);
111 } 112 }
112 113
113 void DnsHostInfo::SetPendingDeleteState() { 114 void DnsHostInfo::SetPendingDeleteState() {
114 DCHECK(ASSIGNED == state_ || ASSIGNED_BUT_MARKED == state_); 115 DCHECK(ASSIGNED == state_ || ASSIGNED_BUT_MARKED == state_);
115 state_ = ASSIGNED_BUT_MARKED; 116 state_ = ASSIGNED_BUT_MARKED;
116 } 117 }
117 118
118 void DnsHostInfo::SetFoundState() { 119 void DnsHostInfo::SetFoundState() {
119 DCHECK(ASSIGNED == state_); 120 DCHECK(ASSIGNED == state_);
120 state_ = FOUND; 121 state_ = FOUND;
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 420
420 case LEARNED_REFERAL_MOTIVATED: 421 case LEARNED_REFERAL_MOTIVATED:
421 return RemoveJs(referring_hostname_); 422 return RemoveJs(referring_hostname_);
422 423
423 default: 424 default:
424 return ""; 425 return "";
425 } 426 }
426 } 427 }
427 428
428 } // namespace chrome_browser_net 429 } // namespace chrome_browser_net
OLDNEW
« no previous file with comments | « chrome/browser/jankometer.cc ('k') | chrome/browser/net/websocket_experiment/websocket_experiment_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698