Index: runtime/vm/dart_api_impl.cc |
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc |
index b282bf2fd913c338eba9f83747b290160c139391..e7d538c024a0844926a9752fe806ac8b2068451d 100644 |
--- a/runtime/vm/dart_api_impl.cc |
+++ b/runtime/vm/dart_api_impl.cc |
@@ -28,6 +28,8 @@ |
namespace dart { |
+ThreadLocalKey Api::api_native_key_ = Thread::kUnsetThreadLocalKey; |
+ |
const char* CanonicalFunction(const char* func) { |
if (strncmp(func, "dart::", 6) == 0) { |
return func + 6; |
@@ -237,6 +239,13 @@ uword Api::Reallocate(uword ptr, intptr_t old_size, intptr_t new_size) { |
} |
+void Api::InitOnce() { |
+ ASSERT(api_native_key_ == Thread::kUnsetThreadLocalKey); |
+ api_native_key_ = Thread::CreateThreadLocal(); |
+ ASSERT(api_native_key_ != Thread::kUnsetThreadLocalKey); |
+} |
+ |
+ |
// --- Handles --- |
@@ -2437,5 +2446,4 @@ DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size) { |
} |
} |
- |
} // namespace dart |