|
4 | 4 | #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
5 | 5 |
|
6 | 6 | #include <memory>
|
| 7 | +#include <string_view> |
7 | 8 |
|
8 | 9 | #include "env-inl.h"
|
9 | 10 | #include "node.h"
|
@@ -126,15 +127,23 @@ struct V8Platform {
|
126 | 127 | }
|
127 | 128 |
|
128 | 129 | inline void StartTracingAgent() {
|
| 130 | + constexpr auto convert_to_set = |
| 131 | + [](std::vector<std::string_view> categories) -> std::set<std::string> { |
| 132 | + std::set<std::string> out; |
| 133 | + for (const auto s : categories) { |
| 134 | + out.emplace(s); |
| 135 | + } |
| 136 | + return out; |
| 137 | + }; |
129 | 138 | // Attach a new NodeTraceWriter only if this function hasn't been called
|
130 | 139 | // before.
|
131 | 140 | if (tracing_file_writer_.IsDefaultHandle()) {
|
132 |
| - std::vector<std::string> categories = |
133 |
| - SplitString(per_process::cli_options->trace_event_categories, ','); |
| 141 | + using std::string_view_literals::operator""sv; |
| 142 | + const std::vector<std::string_view> categories = |
| 143 | + SplitString(per_process::cli_options->trace_event_categories, ","sv); |
134 | 144 |
|
135 | 145 | tracing_file_writer_ = tracing_agent_->AddClient(
|
136 |
| - std::set<std::string>(std::make_move_iterator(categories.begin()), |
137 |
| - std::make_move_iterator(categories.end())), |
| 146 | + convert_to_set(categories), |
138 | 147 | std::unique_ptr<tracing::AsyncTraceWriter>(
|
139 | 148 | new tracing::NodeTraceWriter(
|
140 | 149 | per_process::cli_options->trace_event_file_pattern)),
|
|
0 commit comments