diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2018-12-19 16:58:34 +0800 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2018-12-21 16:48:25 +0800 |
commit | 70f23289aa020cd06d527744be75ce4f0f4c4427 (patch) | |
tree | 2fa1818fa0fd48e879454f91f6479942c00c1e3d /src/node_trace_events.cc | |
parent | 75d0a9335f2f9bab72cdcbe9297d5617133a1d9c (diff) | |
download | android-node-v8-70f23289aa020cd06d527744be75ce4f0f4c4427.tar.gz android-node-v8-70f23289aa020cd06d527744be75ce4f0f4c4427.tar.bz2 android-node-v8-70f23289aa020cd06d527744be75ce4f0f4c4427.zip |
trace_events: move SetupTraceCategoryState into node_trace_events.cc
It makes more sense to put it in `internalBinding('trace_events')`
instead of in the bootstrapper object.
PR-URL: https://github.com/nodejs/node/pull/25128
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_trace_events.cc')
-rw-r--r-- | src/node_trace_events.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/node_trace_events.cc b/src/node_trace_events.cc index 1dfb1de2fc..3c0f1cf68f 100644 --- a/src/node_trace_events.cc +++ b/src/node_trace_events.cc @@ -11,6 +11,7 @@ namespace node { using v8::Array; using v8::Context; +using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; using v8::Local; @@ -102,6 +103,13 @@ void GetEnabledCategories(const FunctionCallbackInfo<Value>& args) { } } +static void SetTraceCategoryStateUpdateHandler( + const FunctionCallbackInfo<Value>& args) { + Environment* env = Environment::GetCurrent(args); + CHECK(args[0]->IsFunction()); + env->set_trace_category_state_function(args[0].As<Function>()); +} + void NodeCategorySet::Initialize(Local<Object> target, Local<Value> unused, Local<Context> context, @@ -109,6 +117,9 @@ void NodeCategorySet::Initialize(Local<Object> target, Environment* env = Environment::GetCurrent(context); env->SetMethod(target, "getEnabledCategories", GetEnabledCategories); + env->SetMethod( + target, "setTraceCategoryStateUpdateHandler", + SetTraceCategoryStateUpdateHandler); Local<FunctionTemplate> category_set = env->NewFunctionTemplate(NodeCategorySet::New); |