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

Side by Side Diff: src/utils/SkEventTracer.cpp

Issue 149563004: initial import of Chrome's trace_event into skia framework (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use SkOnce to sensibly initialize the singleton Created 6 years, 10 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
« src/core/SkTraceEvent.h ('K') | « src/core/SkTraceEvent.h ('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
(Empty)
1 /*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkEventTracer.h"
9 #include "SkOnce.h"
10
11 namespace skia {
12 namespace tracing {
13
14 class SkDefaultEventTracer: public SkEventTracer {
15 virtual TraceEventHandle
16 AddTraceEvent(char phase,
17 const unsigned char* categoryEnabledFlag,
18 const char* name,
19 unsigned long long id,
20 int numArgs,
21 const char** argNames,
22 const unsigned char* argTypes,
23 const unsigned long long* argValues,
24 unsigned char flags) { return 0; }
25
26 virtual void
27 UpdateTraceEventDuration(const unsigned char* categoryEnabledFlag,
28 const char* name,
29 tracing::TraceEventHandle) {};
30
31 virtual const unsigned char* GetCategoryGroupEnabled(const char* name) {
32 static unsigned char no = 1;
33 return &no;
34 };
35 virtual const char* GetCategoryGroupName(
36 const unsigned char* category_group_enabled) {
37 static const char* dummy = "dummy";
38 return dummy;
39 };
40 };
41
42 SkEventTracer *SkEventTracer::_instance;
43
44 static void intiailize_default_tracer(void**) {
45 SkEventTracer::SetInstance(SkNEW(SkDefaultEventTracer));
46 }
47
48 SkEventTracer *SkEventTracer::GetInstance() {
49 SK_DECLARE_STATIC_ONCE(once);
50 SkOnce(&once, intiailize_default_tracer, (void **) NULL);
51 SkASSERT(NULL != SkEventTracer::_instance);
52 return SkEventTracer::_instance;
53 }
54
55 }
56 }
OLDNEW
« src/core/SkTraceEvent.h ('K') | « src/core/SkTraceEvent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698