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

Side by Side Diff: webkit/glue/webkitclient_impl.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
« no previous file with comments | « tools/valgrind/memcheck/suppressions.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "webkit/glue/webkitclient_impl.h" 5 #include "webkit/glue/webkitclient_impl.h"
6 6
7 #if defined(OS_LINUX) 7 #if defined(OS_LINUX)
8 #include <malloc.h> 8 #include <malloc.h>
9 #endif 9 #endif
10 10
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } 257 }
258 258
259 void WebKitClientImpl::incrementStatsCounter(const char* name) { 259 void WebKitClientImpl::incrementStatsCounter(const char* name) {
260 base::StatsCounter(name).Increment(); 260 base::StatsCounter(name).Increment();
261 } 261 }
262 262
263 void WebKitClientImpl::histogramCustomCounts( 263 void WebKitClientImpl::histogramCustomCounts(
264 const char* name, int sample, int min, int max, int bucket_count) { 264 const char* name, int sample, int min, int max, int bucket_count) {
265 // Copied from histogram macro, but without the static variable caching 265 // Copied from histogram macro, but without the static variable caching
266 // the histogram because name is dynamic. 266 // the histogram because name is dynamic.
267 scoped_refptr<base::Histogram> counter = 267 base::Histogram* counter =
268 base::Histogram::FactoryGet(name, min, max, bucket_count, 268 base::Histogram::FactoryGet(name, min, max, bucket_count,
269 base::Histogram::kUmaTargetedHistogramFlag); 269 base::Histogram::kUmaTargetedHistogramFlag);
270 DCHECK_EQ(name, counter->histogram_name()); 270 DCHECK_EQ(name, counter->histogram_name());
271 if (counter.get()) 271 counter->Add(sample);
272 counter->Add(sample);
273 } 272 }
274 273
275 void WebKitClientImpl::histogramEnumeration( 274 void WebKitClientImpl::histogramEnumeration(
276 const char* name, int sample, int boundary_value) { 275 const char* name, int sample, int boundary_value) {
277 // Copied from histogram macro, but without the static variable caching 276 // Copied from histogram macro, but without the static variable caching
278 // the histogram because name is dynamic. 277 // the histogram because name is dynamic.
279 scoped_refptr<base::Histogram> counter = 278 base::Histogram* counter =
280 base::LinearHistogram::FactoryGet(name, 1, boundary_value, 279 base::LinearHistogram::FactoryGet(name, 1, boundary_value,
281 boundary_value + 1, base::Histogram::kUmaTargetedHistogramFlag); 280 boundary_value + 1, base::Histogram::kUmaTargetedHistogramFlag);
282 DCHECK_EQ(name, counter->histogram_name()); 281 DCHECK_EQ(name, counter->histogram_name());
283 if (counter.get()) 282 counter->Add(sample);
284 counter->Add(sample);
285 } 283 }
286 284
287 void WebKitClientImpl::traceEventBegin(const char* name, void* id, 285 void WebKitClientImpl::traceEventBegin(const char* name, void* id,
288 const char* extra) { 286 const char* extra) {
289 TRACE_EVENT_BEGIN(name, id, extra); 287 TRACE_EVENT_BEGIN(name, id, extra);
290 GPU_TRACE_EVENT_BEGIN2("webkit", name, 288 GPU_TRACE_EVENT_BEGIN2("webkit", name,
291 "id", StringPrintf("%p", id).c_str(), 289 "id", StringPrintf("%p", id).c_str(),
292 "extra", extra ? extra : ""); 290 "extra", extra ? extra : "");
293 } 291 }
294 292
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 ++shared_timer_suspended_; 596 ++shared_timer_suspended_;
599 } 597 }
600 598
601 void WebKitClientImpl::ResumeSharedTimer() { 599 void WebKitClientImpl::ResumeSharedTimer() {
602 // The shared timer may have fired or been adjusted while we were suspended. 600 // The shared timer may have fired or been adjusted while we were suspended.
603 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) 601 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning())
604 setSharedTimerFireTime(shared_timer_fire_time_); 602 setSharedTimerFireTime(shared_timer_fire_time_);
605 } 603 }
606 604
607 } // namespace webkit_glue 605 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « tools/valgrind/memcheck/suppressions.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698