chore: enable microtask queue per window agent (#36870)

* chore: enable microtask queue per window agent

* chore: switch policies on context microtask queue

* fix: ensure node::Environment is valid
This commit is contained in:
Robo 2023-01-12 01:59:32 +09:00 committed by GitHub
parent 2a7d0a84c0
commit fefb22a83d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 115 additions and 54 deletions

View file

@ -217,14 +217,14 @@ void SpellCheckClient::SpellCheckWords(const SpellCheckScope& scope,
const std::set<std::u16string>& words) {
DCHECK(!scope.spell_check_.IsEmpty());
auto context = isolate_->GetCurrentContext();
gin_helper::MicrotasksScope microtasks_scope(
isolate_, v8::MicrotasksScope::kDoNotRunMicrotasks);
isolate_, context->GetMicrotaskQueue(),
v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::Local<v8::FunctionTemplate> templ = gin_helper::CreateFunctionTemplate(
isolate_,
base::BindRepeating(&SpellCheckClient::OnSpellCheckDone, AsWeakPtr()));
auto context = isolate_->GetCurrentContext();
v8::Local<v8::Value> args[] = {gin::ConvertToV8(isolate_, words),
templ->GetFunction(context).ToLocalChecked()};
// Call javascript with the words and the callback function