|
22 | 22 | #include "DisposerPHV.h" |
23 | 23 | #include "IsolateWrapper.h" |
24 | 24 |
|
25 | | -#include <mutex> |
26 | 25 | #include <unordered_map> |
27 | | -#include "DevFlags.h" |
28 | | -#include "HMRSupport.h" |
29 | 26 | #include "ModuleBinding.hpp" |
30 | 27 | #include "ModuleInternalCallbacks.h" |
31 | 28 | #include "URLImpl.h" |
32 | 29 | #include "URLPatternImpl.h" |
33 | 30 | #include "URLSearchParamsImpl.h" |
| 31 | +#include <mutex> |
| 32 | +#include "HMRSupport.h" |
| 33 | +#include "DevFlags.h" |
34 | 34 |
|
35 | 35 | #define STRINGIZE(x) #x |
36 | 36 | #define STRINGIZE_VALUE_OF(x) STRINGIZE(x) |
@@ -128,7 +128,7 @@ static void InitializeImportMetaObject(Local<Context> context, Local<Module> mod |
128 | 128 | std::atomic<int> Runtime::nextIsolateId{0}; |
129 | 129 | SimpleAllocator allocator_; |
130 | 130 | NSDictionary* AppPackageJson = nil; |
131 | | -static std::unordered_map<std::string, id> AppConfigCache; // generic cache for app config values |
| 131 | +static std::unordered_map<std::string, id> AppConfigCache; // generic cache for app config values |
132 | 132 | static std::mutex AppConfigCacheMutex; |
133 | 133 |
|
134 | 134 | // Global flag to track when JavaScript errors occur during execution |
@@ -261,9 +261,6 @@ void DisposeIsolateWhenPossible(Isolate* isolate) { |
261 | 261 | v8Initialized_ = true; |
262 | 262 | } |
263 | 263 |
|
264 | | - int runtimeId = Runtime::nextRuntimeId_.fetch_add(1, std::memory_order_relaxed); |
265 | | - this->SetWorkerId(runtimeId); |
266 | | - |
267 | 264 | startTime = platform_->MonotonicallyIncreasingTime(); |
268 | 265 | realtimeOrigin = platform_->CurrentClockTimeMillis(); |
269 | 266 |
|
@@ -304,8 +301,8 @@ void DisposeIsolateWhenPossible(Isolate* isolate) { |
304 | 301 | DefineDrainMicrotaskMethod(isolate, globalTemplate); |
305 | 302 | // queueMicrotask(callback) per spec |
306 | 303 | { |
307 | | - Local<FunctionTemplate> qmtTemplate = |
308 | | - FunctionTemplate::New(isolate, [](const FunctionCallbackInfo<Value>& info) { |
| 304 | + Local<FunctionTemplate> qmtTemplate = FunctionTemplate::New( |
| 305 | + isolate, [](const FunctionCallbackInfo<Value>& info) { |
309 | 306 | auto* isolate = info.GetIsolate(); |
310 | 307 | if (info.Length() < 1 || !info[0]->IsFunction()) { |
311 | 308 | isolate->ThrowException(Exception::TypeError( |
@@ -437,11 +434,6 @@ void DisposeIsolateWhenPossible(Isolate* isolate) { |
437 | 434 | v8::Locker locker(isolate); |
438 | 435 | Isolate::Scope isolate_scope(isolate); |
439 | 436 | HandleScope handle_scope(isolate); |
440 | | - |
441 | | - auto cache = Caches::Get(isolate); |
442 | | - auto context = cache->GetContext(); |
443 | | - Context::Scope context_scope(context); |
444 | | - |
445 | 437 | this->moduleInternal_->RunModule(isolate, "./"); |
446 | 438 | } |
447 | 439 |
|
@@ -496,8 +488,7 @@ void DisposeIsolateWhenPossible(Isolate* isolate) { |
496 | 488 | result = AppPackageJson[nsKey]; |
497 | 489 | } |
498 | 490 |
|
499 | | - // Store in cache (can cache nil as NSNull to differentiate presence if desired; for now, cache |
500 | | - // as-is) |
| 491 | + // Store in cache (can cache nil as NSNull to differentiate presence if desired; for now, cache as-is) |
501 | 492 | { |
502 | 493 | std::lock_guard<std::mutex> lock(AppConfigCacheMutex); |
503 | 494 | AppConfigCache[key] = result; |
@@ -633,7 +624,6 @@ void DisposeIsolateWhenPossible(Isolate* isolate) { |
633 | 624 | std::vector<Isolate*> Runtime::isolates_; |
634 | 625 | bool Runtime::v8Initialized_ = false; |
635 | 626 | thread_local Runtime* Runtime::currentRuntime_ = nullptr; |
636 | | -std::atomic<int> Runtime::nextRuntimeId_ = {0}; |
637 | 627 | SpinMutex Runtime::isolatesMutex_; |
638 | 628 |
|
639 | 629 | } // namespace tns |
0 commit comments