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

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

Issue 6780035: Use lock-free lazy initialization for static histogram references (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 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 "chrome/browser/net/url_info.h" 5 #include "chrome/browser/net/url_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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 state_ = old_prequeue_state_; 113 state_ = old_prequeue_state_;
114 DLogResultsStats("DNS Prefetch reset to prequeue"); 114 DLogResultsStats("DNS Prefetch reset to prequeue");
115 static const TimeDelta kBoundary = TimeDelta::FromSeconds(2); 115 static const TimeDelta kBoundary = TimeDelta::FromSeconds(2);
116 if (queue_duration_ > kBoundary) { 116 if (queue_duration_ > kBoundary) {
117 UMA_HISTOGRAM_MEDIUM_TIMES("DNS.QueueRecycledDeltaOver2", 117 UMA_HISTOGRAM_MEDIUM_TIMES("DNS.QueueRecycledDeltaOver2",
118 queue_duration_ - kBoundary); 118 queue_duration_ - kBoundary);
119 return; 119 return;
120 } 120 }
121 // Make a custom linear histogram for the region from 0 to boundary. 121 // Make a custom linear histogram for the region from 0 to boundary.
122 const size_t kBucketCount = 52; 122 const size_t kBucketCount = 52;
123 scoped_refptr<base::Histogram> histogram = 123 static base::Histogram* histogram(NULL);
124 base::LinearHistogram::FactoryTimeGet( 124 if (!histogram)
125 "DNS.QueueRecycledUnder2", TimeDelta(), kBoundary, kBucketCount, 125 histogram = base::LinearHistogram::FactoryTimeGet(
126 base::Histogram::kUmaTargetedHistogramFlag); 126 "DNS.QueueRecycledUnder2", TimeDelta(), kBoundary, kBucketCount,
127 base::Histogram::kUmaTargetedHistogramFlag);
127 histogram->AddTime(queue_duration_); 128 histogram->AddTime(queue_duration_);
128 } 129 }
129 130
130 void UrlInfo::SetPendingDeleteState() { 131 void UrlInfo::SetPendingDeleteState() {
131 DCHECK(ASSIGNED == state_ || ASSIGNED_BUT_MARKED == state_); 132 DCHECK(ASSIGNED == state_ || ASSIGNED_BUT_MARKED == state_);
132 state_ = ASSIGNED_BUT_MARKED; 133 state_ = ASSIGNED_BUT_MARKED;
133 } 134 }
134 135
135 void UrlInfo::SetFoundState() { 136 void UrlInfo::SetFoundState() {
136 DCHECK(ASSIGNED == state_); 137 DCHECK(ASSIGNED == state_);
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 340
340 case LEARNED_REFERAL_MOTIVATED: 341 case LEARNED_REFERAL_MOTIVATED:
341 return RemoveJs(referring_url_.spec()); 342 return RemoveJs(referring_url_.spec());
342 343
343 default: 344 default:
344 return ""; 345 return "";
345 } 346 }
346 } 347 }
347 348
348 } // namespace chrome_browser_net 349 } // namespace chrome_browser_net
OLDNEW
« no previous file with comments | « chrome/browser/metrics/thread_watcher.cc ('k') | chrome/browser/net/websocket_experiment/websocket_experiment_task.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698