File tree Expand file tree Collapse file tree 3 files changed +16
-10
lines changed Expand file tree Collapse file tree 3 files changed +16
-10
lines changed Original file line number Diff line number Diff line change 1818/* global isMainThread */
1919
2020const {
21- _setupTraceCategoryState,
2221 _setupNextTick,
2322 _setupPromises, _chdir, _cpuUsage,
2423 _hrtime, _hrtimeBigInt,
@@ -401,7 +400,10 @@ function readAndExecuteStdin() {
401400}
402401
403402function setupTraceCategoryState ( ) {
404- const { traceCategoryState } = internalBinding ( 'trace_events' ) ;
403+ const {
404+ traceCategoryState,
405+ setTraceCategoryStateUpdateHandler
406+ } = internalBinding ( 'trace_events' ) ;
405407 const kCategoryAsyncHooks = 0 ;
406408 let traceEventsAsyncHook ;
407409
@@ -423,7 +425,7 @@ function setupTraceCategoryState() {
423425 }
424426
425427 toggleTraceCategoryState ( ) ;
426- _setupTraceCategoryState ( toggleTraceCategoryState ) ;
428+ setTraceCategoryStateUpdateHandler ( toggleTraceCategoryState ) ;
427429}
428430
429431function setupProcessObject ( ) {
Original file line number Diff line number Diff line change @@ -30,12 +30,6 @@ void RunMicrotasks(const FunctionCallbackInfo<Value>& args) {
3030 args.GetIsolate ()->RunMicrotasks ();
3131}
3232
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-
3933void SetupNextTick (const FunctionCallbackInfo<Value>& args) {
4034 Environment* env = Environment::GetCurrent (args);
4135 Isolate* isolate = env->isolate ();
@@ -136,7 +130,6 @@ void SetupPromises(const FunctionCallbackInfo<Value>& args) {
136130// completes so that it can be gc'd as soon as possible.
137131void SetupBootstrapObject(Environment* env,
138132 Local<Object> bootstrapper) {
139- BOOTSTRAP_METHOD (_setupTraceCategoryState, SetupTraceCategoryState);
140133 BOOTSTRAP_METHOD (_setupNextTick, SetupNextTick);
141134 BOOTSTRAP_METHOD (_setupPromises, SetupPromises);
142135 BOOTSTRAP_METHOD (_chdir, Chdir);
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ namespace node {
1111
1212using v8::Array;
1313using v8::Context;
14+ using v8::Function;
1415using v8::FunctionCallbackInfo;
1516using v8::FunctionTemplate;
1617using v8::Local;
@@ -102,13 +103,23 @@ void GetEnabledCategories(const FunctionCallbackInfo<Value>& args) {
102103 }
103104}
104105
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+
105113void NodeCategorySet::Initialize (Local<Object> target,
106114 Local<Value> unused,
107115 Local<Context> context,
108116 void * priv) {
109117 Environment* env = Environment::GetCurrent (context);
110118
111119 env->SetMethod (target, " getEnabledCategories" , GetEnabledCategories);
120+ env->SetMethod (
121+ target, " setTraceCategoryStateUpdateHandler" ,
122+ SetTraceCategoryStateUpdateHandler);
112123
113124 Local<FunctionTemplate> category_set =
114125 env->NewFunctionTemplate (NodeCategorySet::New);
You can’t perform that action at this time.
0 commit comments