File tree 3 files changed +16
-10
lines changed
3 files changed +16
-10
lines changed Original file line number Diff line number Diff line change 18
18
/* global isMainThread */
19
19
20
20
const {
21
- _setupTraceCategoryState,
22
21
_setupNextTick,
23
22
_setupPromises, _chdir, _cpuUsage,
24
23
_hrtime, _hrtimeBigInt,
@@ -401,7 +400,10 @@ function readAndExecuteStdin() {
401
400
}
402
401
403
402
function setupTraceCategoryState ( ) {
404
- const { traceCategoryState } = internalBinding ( 'trace_events' ) ;
403
+ const {
404
+ traceCategoryState,
405
+ setTraceCategoryStateUpdateHandler
406
+ } = internalBinding ( 'trace_events' ) ;
405
407
const kCategoryAsyncHooks = 0 ;
406
408
let traceEventsAsyncHook ;
407
409
@@ -423,7 +425,7 @@ function setupTraceCategoryState() {
423
425
}
424
426
425
427
toggleTraceCategoryState ( ) ;
426
- _setupTraceCategoryState ( toggleTraceCategoryState ) ;
428
+ setTraceCategoryStateUpdateHandler ( toggleTraceCategoryState ) ;
427
429
}
428
430
429
431
function setupProcessObject ( ) {
Original file line number Diff line number Diff line change @@ -30,12 +30,6 @@ void RunMicrotasks(const FunctionCallbackInfo<Value>& args) {
30
30
args.GetIsolate ()->RunMicrotasks ();
31
31
}
32
32
33
- void SetupTraceCategoryState (const FunctionCallbackInfo<Value>& args) {
34
- Environment* env = Environment::GetCurrent (args);
35
- CHECK (args[0 ]->IsFunction ());
36
- env->set_trace_category_state_function (args[0 ].As <Function>());
37
- }
38
-
39
33
void SetupNextTick (const FunctionCallbackInfo<Value>& args) {
40
34
Environment* env = Environment::GetCurrent (args);
41
35
Isolate* isolate = env->isolate ();
@@ -136,7 +130,6 @@ void SetupPromises(const FunctionCallbackInfo<Value>& args) {
136
130
// completes so that it can be gc'd as soon as possible.
137
131
void SetupBootstrapObject(Environment* env,
138
132
Local<Object> bootstrapper) {
139
- BOOTSTRAP_METHOD (_setupTraceCategoryState, SetupTraceCategoryState);
140
133
BOOTSTRAP_METHOD (_setupNextTick, SetupNextTick);
141
134
BOOTSTRAP_METHOD (_setupPromises, SetupPromises);
142
135
BOOTSTRAP_METHOD (_chdir, Chdir);
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ namespace node {
11
11
12
12
using v8::Array;
13
13
using v8::Context;
14
+ using v8::Function;
14
15
using v8::FunctionCallbackInfo;
15
16
using v8::FunctionTemplate;
16
17
using v8::Local;
@@ -102,13 +103,23 @@ void GetEnabledCategories(const FunctionCallbackInfo<Value>& args) {
102
103
}
103
104
}
104
105
106
+ static void SetTraceCategoryStateUpdateHandler (
107
+ const FunctionCallbackInfo<Value>& args) {
108
+ Environment* env = Environment::GetCurrent (args);
109
+ CHECK (args[0 ]->IsFunction ());
110
+ env->set_trace_category_state_function (args[0 ].As <Function>());
111
+ }
112
+
105
113
void NodeCategorySet::Initialize (Local<Object> target,
106
114
Local<Value> unused,
107
115
Local<Context> context,
108
116
void * priv) {
109
117
Environment* env = Environment::GetCurrent (context);
110
118
111
119
env->SetMethod (target, " getEnabledCategories" , GetEnabledCategories);
120
+ env->SetMethod (
121
+ target, " setTraceCategoryStateUpdateHandler" ,
122
+ SetTraceCategoryStateUpdateHandler);
112
123
113
124
Local<FunctionTemplate> category_set =
114
125
env->NewFunctionTemplate (NodeCategorySet::New);
You can’t perform that action at this time.
0 commit comments