refactor: use std::optional in MicrotasksScope (#43621)

avoid an unnecessary heap allocation/free
This commit is contained in:
Charles Kerr 2024-09-09 11:51:42 -05:00 committed by GitHub
parent e2fe8f50e2
commit 2844e346b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 4 deletions

View file

@ -16,8 +16,7 @@ MicrotasksScope::MicrotasksScope(v8::Isolate* isolate,
if (!ignore_browser_checkpoint)
v8::MicrotasksScope::PerformCheckpoint(isolate);
} else {
v8_microtasks_scope_ = std::make_unique<v8::MicrotasksScope>(
isolate, microtask_queue, scope_type);
v8_microtasks_scope_.emplace(isolate, microtask_queue, scope_type);
}
}