Remove unused did_first_* fields from InternalDocumentStateData.
[chromium-blink-merge.git] / skia / ext / event_tracer_impl.cc
blobf6e12f05d605a198d7777bbcda02162b17d220db
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
3 // found in the LICENSE file.
5 #include "base/trace_event/trace_event.h"
6 #include "skia/ext/event_tracer_impl.h"
7 #include "third_party/skia/include/utils/SkEventTracer.h"
9 namespace skia {
11 class SkChromiumEventTracer: public SkEventTracer {
12 const uint8_t* getCategoryGroupEnabled(const char* name) override;
13 const char* getCategoryGroupName(const uint8_t* categoryEnabledFlag) override;
14 SkEventTracer::Handle addTraceEvent(char phase,
15 const uint8_t* categoryEnabledFlag,
16 const char* name,
17 uint64_t id,
18 int32_t numArgs,
19 const char** argNames,
20 const uint8_t* argTypes,
21 const uint64_t* argValues,
22 uint8_t flags) override;
23 void updateTraceEventDuration(const uint8_t* categoryEnabledFlag,
24 const char* name,
25 SkEventTracer::Handle handle) override;
28 const uint8_t*
29 SkChromiumEventTracer::getCategoryGroupEnabled(const char* name) {
30 return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(name);
33 const char* SkChromiumEventTracer::getCategoryGroupName(
34 const uint8_t* categoryEnabledFlag) {
35 return base::trace_event::TraceLog::GetCategoryGroupName(categoryEnabledFlag);
38 SkEventTracer::Handle
39 SkChromiumEventTracer::addTraceEvent(char phase,
40 const uint8_t* categoryEnabledFlag,
41 const char* name,
42 uint64_t id,
43 int32_t numArgs,
44 const char** argNames,
45 const uint8_t* argTypes,
46 const uint64_t* argValues,
47 uint8_t flags) {
48 base::trace_event::TraceEventHandle handle = TRACE_EVENT_API_ADD_TRACE_EVENT(
49 phase, categoryEnabledFlag, name, id, numArgs, argNames, argTypes,
50 (const long long unsigned int*)argValues, NULL, flags);
51 SkEventTracer::Handle result;
52 memcpy(&result, &handle, sizeof(result));
53 return result;
56 void
57 SkChromiumEventTracer::updateTraceEventDuration(
58 const uint8_t* categoryEnabledFlag,
59 const char *name,
60 SkEventTracer::Handle handle) {
61 base::trace_event::TraceEventHandle traceEventHandle;
62 memcpy(&traceEventHandle, &handle, sizeof(handle));
63 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(
64 categoryEnabledFlag, name, traceEventHandle);
67 } // namespace skia
70 void InitSkiaEventTracer() {
71 // Initialize the binding to Skia's tracing events. Skia will
72 // take ownership of and clean up the memory allocated here.
73 SkEventTracer::SetInstance(new skia::SkChromiumEventTracer());