refactor: migrates util::Promise to gin (#20871)
* refactor: use gin in Promise * refactor: separate Promise impl that returns nothing * refactor: use Promise<void> for promise that returns nothing * fix: methods should be able to run on both browser and renderer process * fix: should not pass base::StringPiece across threads * refactor: no more need to use different ResolvePromise for empty Promise * refactor: move Promise to gin_helper
This commit is contained in:
parent
bff113760a
commit
eaf2c61bef
48 changed files with 483 additions and 479 deletions
|
@ -65,8 +65,7 @@ void Debugger::DispatchProtocolMessage(DevToolsAgentHost* agent_host,
|
|||
if (it == pending_requests_.end())
|
||||
return;
|
||||
|
||||
electron::util::Promise<base::DictionaryValue> promise =
|
||||
std::move(it->second);
|
||||
gin_helper::Promise<base::DictionaryValue> promise = std::move(it->second);
|
||||
pending_requests_.erase(it);
|
||||
|
||||
base::DictionaryValue* error = nullptr;
|
||||
|
@ -80,7 +79,7 @@ void Debugger::DispatchProtocolMessage(DevToolsAgentHost* agent_host,
|
|||
if (dict->GetDictionary("result", &result_body)) {
|
||||
result.Swap(result_body);
|
||||
}
|
||||
promise.ResolveWithGin(result);
|
||||
promise.Resolve(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +129,7 @@ void Debugger::Detach() {
|
|||
}
|
||||
|
||||
v8::Local<v8::Promise> Debugger::SendCommand(gin_helper::Arguments* args) {
|
||||
electron::util::Promise<base::DictionaryValue> promise(isolate());
|
||||
gin_helper::Promise<base::DictionaryValue> promise(isolate());
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
if (!agent_host_) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue