Skip to content

Commit bf5ea81

Browse files
ofrobotsCommit Bot
authored andcommitted
[tracing] allow dynamic control of tracing
If the trace_buffer_ was null, we were returning a pointer to a static flag back that permanently disabled that particular trace point. This implied an assumption that tracing will be statically enabled at process startup, and once it is disabled, it will never be enabled again. On Node.js side we want to dynamically enable/disable tracing as per programmer intent. Change-Id: Ic7a7839b8450ab5c356d85e8e0826f42824907f4 Reviewed-on: https://chromium-review.googlesource.com/1161518 Reviewed-by: Yang Guo <[email protected]> Commit-Queue: Ali Ijaz Sheikh <[email protected]> Cr-Commit-Position: refs/heads/master@{#54903}
1 parent a8f6869 commit bf5ea81

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/libplatform/tracing/tracing-controller.cc

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,17 @@ namespace tracing {
2424
// convert internally to determine the category name from the char enabled
2525
// pointer.
2626
const char* g_category_groups[MAX_CATEGORY_GROUPS] = {
27-
"toplevel", "tracing already shutdown",
27+
"toplevel",
2828
"tracing categories exhausted; must increase MAX_CATEGORY_GROUPS",
2929
"__metadata"};
3030

3131
// The enabled flag is char instead of bool so that the API can be used from C.
3232
unsigned char g_category_group_enabled[MAX_CATEGORY_GROUPS] = {0};
3333
// Indexes here have to match the g_category_groups array indexes above.
34-
const int g_category_already_shutdown = 1;
35-
const int g_category_categories_exhausted = 2;
34+
const int g_category_categories_exhausted = 1;
3635
// Metadata category not used in V8.
37-
// const int g_category_metadata = 3;
38-
const int g_num_builtin_categories = 4;
36+
// const int g_category_metadata = 2;
37+
const int g_num_builtin_categories = 3;
3938

4039
// Skip default categories.
4140
v8::base::AtomicWord g_category_index = g_num_builtin_categories;
@@ -103,10 +102,6 @@ void TracingController::UpdateTraceEventDuration(
103102

104103
const uint8_t* TracingController::GetCategoryGroupEnabled(
105104
const char* category_group) {
106-
if (!trace_buffer_) {
107-
DCHECK(!g_category_group_enabled[g_category_already_shutdown]);
108-
return &g_category_group_enabled[g_category_already_shutdown];
109-
}
110105
return GetCategoryGroupEnabledInternal(category_group);
111106
}
112107

0 commit comments

Comments
 (0)