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

Side by Side Diff: gin/v8_platform.cc

Issue 1742603004: Use Scoped version of AddTraceEvent for V8 Tracing in Chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « gin/public/v8_platform.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
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 "gin/public/v8_platform.h" 5 #include "gin/public/v8_platform.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/threading/worker_pool.h" 9 #include "base/threading/worker_pool.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 const char* V8Platform::GetCategoryGroupName( 69 const char* V8Platform::GetCategoryGroupName(
70 const uint8_t* category_enabled_flag) { 70 const uint8_t* category_enabled_flag) {
71 return base::trace_event::TraceLog::GetCategoryGroupName( 71 return base::trace_event::TraceLog::GetCategoryGroupName(
72 category_enabled_flag); 72 category_enabled_flag);
73 } 73 }
74 74
75 uint64_t V8Platform::AddTraceEvent(char phase, 75 uint64_t V8Platform::AddTraceEvent(char phase,
76 const uint8_t* category_enabled_flag, 76 const uint8_t* category_enabled_flag,
77 const char* name, 77 const char* name,
78 const char* scope,
78 uint64_t id, 79 uint64_t id,
79 uint64_t bind_id, 80 uint64_t bind_id,
80 int32_t num_args, 81 int32_t num_args,
81 const char** arg_names, 82 const char** arg_names,
82 const uint8_t* arg_types, 83 const uint8_t* arg_types,
83 const uint64_t* arg_values, 84 const uint64_t* arg_values,
84 unsigned int flags) { 85 unsigned int flags) {
85 base::trace_event::TraceEventHandle handle = 86 base::trace_event::TraceEventHandle handle =
86 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_BIND_ID( 87 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_BIND_ID(
87 phase, category_enabled_flag, name, 88 phase, category_enabled_flag, name, scope, id, bind_id, num_args,
88 trace_event_internal::kGlobalScope, id, bind_id, num_args, arg_names, 89 arg_names, arg_types, (const long long unsigned int*)arg_values, NULL,
89 arg_types, (const long long unsigned int*)arg_values, NULL, flags); 90 flags);
90 uint64_t result; 91 uint64_t result;
91 memcpy(&result, &handle, sizeof(result)); 92 memcpy(&result, &handle, sizeof(result));
92 return result; 93 return result;
93 } 94 }
94 95
95 void V8Platform::UpdateTraceEventDuration(const uint8_t* category_enabled_flag, 96 void V8Platform::UpdateTraceEventDuration(const uint8_t* category_enabled_flag,
96 const char* name, 97 const char* name,
97 uint64_t handle) { 98 uint64_t handle) {
98 base::trace_event::TraceEventHandle traceEventHandle; 99 base::trace_event::TraceEventHandle traceEventHandle;
99 memcpy(&traceEventHandle, &handle, sizeof(handle)); 100 memcpy(&traceEventHandle, &handle, sizeof(handle));
100 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_enabled_flag, name, 101 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_enabled_flag, name,
101 traceEventHandle); 102 traceEventHandle);
102 } 103 }
103 104
104 } // namespace gin 105 } // namespace gin
OLDNEW
« no previous file with comments | « gin/public/v8_platform.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698