@@ -24,17 +24,16 @@ using v8::Number;
|
24 | 24 | using v8::Object; |
25 | 25 | using v8::Value; |
26 | 26 | |
27 | | -thread_local std::unordered_map<std::string, int> generic_usage_counters; |
| 27 | +thread_local std::unordered_map<FastStringKey, int, FastStringKey::Hash> |
| 28 | + generic_usage_counters; |
28 | 29 | thread_local std::unordered_map<FastStringKey, int, FastStringKey::Hash> |
29 | 30 | v8_fast_api_call_counts; |
30 | 31 | |
31 | | -void CountGenericUsage(const char* counter_name) { |
32 | | -if (generic_usage_counters.find(counter_name) == generic_usage_counters.end()) |
33 | | - generic_usage_counters[counter_name] = 0; |
| 32 | +void CountGenericUsage(FastStringKey counter_name) { |
34 | 33 | generic_usage_counters[counter_name]++; |
35 | 34 | } |
36 | 35 | |
37 | | -int GetGenericUsageCount(const char* counter_name) { |
| 36 | +int GetGenericUsageCount(FastStringKey counter_name) { |
38 | 37 | return generic_usage_counters[counter_name]; |
39 | 38 | } |
40 | 39 | |
@@ -53,8 +52,8 @@ void GetGenericUsageCount(const FunctionCallbackInfo<Value>& args) {
|
53 | 52 | return; |
54 | 53 | } |
55 | 54 | Utf8Value utf8_key(env->isolate(), args[0]); |
56 | | - args.GetReturnValue().Set( |
57 | | -GetGenericUsageCount(utf8_key.ToStringView().data())); |
| 55 | + args.GetReturnValue().Set(GetGenericUsageCount( |
| 56 | +FastStringKey::AllowDynamic(utf8_key.ToStringView()))); |
58 | 57 | } |
59 | 58 | |
60 | 59 | void GetV8FastApiCallCount(const FunctionCallbackInfo<Value>& args) { |
|