OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/trace_event/trace_event.h" | 5 #include "base/trace_event/trace_event.h" |
6 #include "skia/ext/event_tracer_impl.h" | 6 #include "skia/ext/event_tracer_impl.h" |
7 #include "third_party/skia/include/utils/SkEventTracer.h" | 7 #include "third_party/skia/include/utils/SkEventTracer.h" |
8 | 8 |
9 namespace skia { | 9 namespace skia { |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 SkEventTracer::Handle handle) override; | 25 SkEventTracer::Handle handle) override; |
26 }; | 26 }; |
27 | 27 |
28 const uint8_t* | 28 const uint8_t* |
29 SkChromiumEventTracer::getCategoryGroupEnabled(const char* name) { | 29 SkChromiumEventTracer::getCategoryGroupEnabled(const char* name) { |
30 return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(name); | 30 return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(name); |
31 } | 31 } |
32 | 32 |
33 const char* SkChromiumEventTracer::getCategoryGroupName( | 33 const char* SkChromiumEventTracer::getCategoryGroupName( |
34 const uint8_t* categoryEnabledFlag) { | 34 const uint8_t* categoryEnabledFlag) { |
35 return base::debug::TraceLog::GetCategoryGroupName( | 35 return base::trace_event::TraceLog::GetCategoryGroupName(categoryEnabledFlag); |
36 categoryEnabledFlag); | |
37 } | 36 } |
38 | 37 |
39 SkEventTracer::Handle | 38 SkEventTracer::Handle |
40 SkChromiumEventTracer::addTraceEvent(char phase, | 39 SkChromiumEventTracer::addTraceEvent(char phase, |
41 const uint8_t* categoryEnabledFlag, | 40 const uint8_t* categoryEnabledFlag, |
42 const char* name, | 41 const char* name, |
43 uint64_t id, | 42 uint64_t id, |
44 int32_t numArgs, | 43 int32_t numArgs, |
45 const char** argNames, | 44 const char** argNames, |
46 const uint8_t* argTypes, | 45 const uint8_t* argTypes, |
47 const uint64_t* argValues, | 46 const uint64_t* argValues, |
48 uint8_t flags) { | 47 uint8_t flags) { |
49 base::debug::TraceEventHandle handle = TRACE_EVENT_API_ADD_TRACE_EVENT( | 48 base::trace_event::TraceEventHandle handle = TRACE_EVENT_API_ADD_TRACE_EVENT( |
50 phase, categoryEnabledFlag, name, id, numArgs, argNames, | 49 phase, categoryEnabledFlag, name, id, numArgs, argNames, argTypes, |
51 argTypes, (const long long unsigned int*) argValues, NULL, flags); | 50 (const long long unsigned int*)argValues, NULL, flags); |
52 SkEventTracer::Handle result; | 51 SkEventTracer::Handle result; |
53 memcpy(&result, &handle, sizeof(result)); | 52 memcpy(&result, &handle, sizeof(result)); |
54 return result; | 53 return result; |
55 } | 54 } |
56 | 55 |
57 void | 56 void |
58 SkChromiumEventTracer::updateTraceEventDuration( | 57 SkChromiumEventTracer::updateTraceEventDuration( |
59 const uint8_t* categoryEnabledFlag, | 58 const uint8_t* categoryEnabledFlag, |
60 const char *name, | 59 const char *name, |
61 SkEventTracer::Handle handle) { | 60 SkEventTracer::Handle handle) { |
62 base::debug::TraceEventHandle traceEventHandle; | 61 base::trace_event::TraceEventHandle traceEventHandle; |
63 memcpy(&traceEventHandle, &handle, sizeof(handle)); | 62 memcpy(&traceEventHandle, &handle, sizeof(handle)); |
64 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( | 63 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( |
65 categoryEnabledFlag, name, traceEventHandle); | 64 categoryEnabledFlag, name, traceEventHandle); |
66 } | 65 } |
67 | 66 |
68 } // namespace skia | 67 } // namespace skia |
69 | 68 |
70 | 69 |
71 void InitSkiaEventTracer() { | 70 void InitSkiaEventTracer() { |
72 // Initialize the binding to Skia's tracing events. Skia will | 71 // Initialize the binding to Skia's tracing events. Skia will |
73 // take ownership of and clean up the memory allocated here. | 72 // take ownership of and clean up the memory allocated here. |
74 SkEventTracer::SetInstance(new skia::SkChromiumEventTracer()); | 73 SkEventTracer::SetInstance(new skia::SkChromiumEventTracer()); |
75 } | 74 } |
OLD | NEW |