src: remove unnecessary copy operations in tracing

PR-URL: https://github.com/nodejs/node/pull/20356
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
This commit is contained in:
Anna Henningsen 2018-04-27 15:21:17 +02:00 committed by Anatoli Papirovski
parent 16aee380a5
commit 7016ee658a
No known key found for this signature in database
GPG Key ID: 614E2E1ABEB4B2C0

View File

@ -63,7 +63,7 @@ void NodeCategorySet::Enable(const FunctionCallbackInfo<Value>& args) {
NodeCategorySet* category_set; NodeCategorySet* category_set;
ASSIGN_OR_RETURN_UNWRAP(&category_set, args.Holder()); ASSIGN_OR_RETURN_UNWRAP(&category_set, args.Holder());
CHECK_NE(category_set, nullptr); CHECK_NE(category_set, nullptr);
auto categories = category_set->GetCategories(); const auto& categories = category_set->GetCategories();
if (!category_set->enabled_ && !categories.empty()) { if (!category_set->enabled_ && !categories.empty()) {
env->tracing_agent()->Enable(categories); env->tracing_agent()->Enable(categories);
category_set->enabled_ = true; category_set->enabled_ = true;
@ -75,7 +75,7 @@ void NodeCategorySet::Disable(const FunctionCallbackInfo<Value>& args) {
NodeCategorySet* category_set; NodeCategorySet* category_set;
ASSIGN_OR_RETURN_UNWRAP(&category_set, args.Holder()); ASSIGN_OR_RETURN_UNWRAP(&category_set, args.Holder());
CHECK_NE(category_set, nullptr); CHECK_NE(category_set, nullptr);
auto categories = category_set->GetCategories(); const auto& categories = category_set->GetCategories();
if (category_set->enabled_ && !categories.empty()) { if (category_set->enabled_ && !categories.empty()) {
env->tracing_agent()->Disable(categories); env->tracing_agent()->Disable(categories);
category_set->enabled_ = false; category_set->enabled_ = false;