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

Side by Side Diff: gin/event_tracer_impl.cc

Issue 707273005: (WIP) Implement V8 Tracing -- DO NOT LAND (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « gin/event_tracer_impl.h ('k') | gin/gin.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <v8-tracing.h>
4 5
5 #include "base/debug/trace_event.h" 6 #include "base/debug/trace_event.h"
6 #include "skia/ext/event_tracer_impl.h" 7 #include "event_tracer_impl.h"
7 #include "third_party/skia/include/utils/SkEventTracer.h"
8 8
9 namespace skia { 9 namespace gin {
10 10
11 class SkChromiumEventTracer: public SkEventTracer { 11 class ChromiumEventTracer: public v8::EventTracer {
12 const uint8_t* getCategoryGroupEnabled(const char* name) override; 12 const uint8_t* getCategoryGroupEnabled(const char* name) override;
13 const char* getCategoryGroupName(const uint8_t* categoryEnabledFlag) override; 13 const char* getCategoryGroupName(const uint8_t* categoryEnabledFlag) override;
14 SkEventTracer::Handle addTraceEvent(char phase, 14 EventTracer::Handle addTraceEvent(char phase,
15 const uint8_t* categoryEnabledFlag, 15 const uint8_t* categoryEnabledFlag,
16 const char* name, 16 const char* name,
17 uint64_t id, 17 uint64_t id,
18 int32_t numArgs, 18 int32_t numArgs,
19 const char** argNames, 19 const char** argNames,
20 const uint8_t* argTypes, 20 const uint8_t* argTypes,
21 const uint64_t* argValues, 21 const uint64_t* argValues,
22 uint8_t flags) override; 22 uint8_t flags) override;
23 void updateTraceEventDuration(const uint8_t* categoryEnabledFlag, 23 void updateTraceEventDuration(const uint8_t* categoryEnabledFlag,
24 const char* name, 24 const char* name,
25 SkEventTracer::Handle handle) override; 25 EventTracer::Handle handle) override;
26 }; 26 };
27 27
28 const uint8_t* 28 const uint8_t*
29 SkChromiumEventTracer::getCategoryGroupEnabled(const char* name) { 29 ChromiumEventTracer::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* ChromiumEventTracer::getCategoryGroupName(
34 const uint8_t* categoryEnabledFlag) { 34 const uint8_t* categoryEnabledFlag) {
35 return base::debug::TraceLog::GetCategoryGroupName( 35 return base::debug::TraceLog::GetCategoryGroupName(
36 categoryEnabledFlag); 36 categoryEnabledFlag);
37 } 37 }
38 38
39 SkEventTracer::Handle 39 v8::EventTracer::Handle
40 SkChromiumEventTracer::addTraceEvent(char phase, 40 ChromiumEventTracer::addTraceEvent(char phase,
41 const uint8_t* categoryEnabledFlag, 41 const uint8_t* categoryEnabledFlag,
42 const char* name, 42 const char* name,
43 uint64_t id, 43 uint64_t id,
44 int32_t numArgs, 44 int32_t numArgs,
45 const char** argNames, 45 const char** argNames,
46 const uint8_t* argTypes, 46 const uint8_t* argTypes,
47 const uint64_t* argValues, 47 const uint64_t* argValues,
48 uint8_t flags) { 48 uint8_t flags) {
49 base::debug::TraceEventHandle handle = TRACE_EVENT_API_ADD_TRACE_EVENT( 49 base::debug::TraceEventHandle handle = TRACE_EVENT_API_ADD_TRACE_EVENT(
50 phase, categoryEnabledFlag, name, id, numArgs, argNames, 50 phase, categoryEnabledFlag, name, id, numArgs, argNames,
51 argTypes, (const long long unsigned int*) argValues, NULL, flags); 51 argTypes, (const long long unsigned int*) argValues, NULL, flags);
52 SkEventTracer::Handle result; 52 EventTracer::Handle result;
53 memcpy(&result, &handle, sizeof(result)); 53 memcpy(&result, &handle, sizeof(result));
54 return result; 54 return result;
55 } 55 }
56 56
57 void 57 void
58 SkChromiumEventTracer::updateTraceEventDuration( 58 ChromiumEventTracer::updateTraceEventDuration(
59 const uint8_t* categoryEnabledFlag, 59 const uint8_t* categoryEnabledFlag,
60 const char *name, 60 const char *name,
61 SkEventTracer::Handle handle) { 61 EventTracer::Handle handle) {
62 base::debug::TraceEventHandle traceEventHandle; 62 base::debug::TraceEventHandle traceEventHandle;
63 memcpy(&traceEventHandle, &handle, sizeof(handle)); 63 memcpy(&traceEventHandle, &handle, sizeof(handle));
64 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( 64 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(
65 categoryEnabledFlag, name, traceEventHandle); 65 categoryEnabledFlag, name, traceEventHandle);
66 } 66 }
67 67
68 } // namespace skia 68 } // namespace gin
69 69
70 70
71 void InitSkiaEventTracer() { 71 void InitV8EventTracer() {
72 // Initialize the binding to Skia's tracing events. Skia will 72 // Initialize the binding to ia's tracing events. ia will
73 // take ownership of and clean up the memory allocated here. 73 // take ownership of and clean up the memory allocated here.
74 SkEventTracer::SetInstance(new skia::SkChromiumEventTracer()); 74 v8::EventTracer::SetInstance(new gin::ChromiumEventTracer());
75 } 75 }
OLDNEW
« no previous file with comments | « gin/event_tracer_impl.h ('k') | gin/gin.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698