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
|
@ -15,9 +15,9 @@
|
|||
#include "shell/common/api/api.mojom.h"
|
||||
#include "shell/common/gin_converters/blink_converter.h"
|
||||
#include "shell/common/gin_converters/value_converter.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
#include "shell/common/node_bindings.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
#include "shell/common/promise_util.h"
|
||||
#include "third_party/blink/public/web/web_local_frame.h"
|
||||
|
||||
using blink::WebLocalFrame;
|
||||
|
@ -90,14 +90,14 @@ class IPCRenderer : public gin::Wrappable<IPCRenderer> {
|
|||
if (!gin::ConvertFromV8(isolate, arguments, &message)) {
|
||||
return v8::Local<v8::Promise>();
|
||||
}
|
||||
electron::util::Promise<blink::CloneableMessage> p(isolate);
|
||||
gin_helper::Promise<blink::CloneableMessage> p(isolate);
|
||||
auto handle = p.GetHandle();
|
||||
|
||||
electron_browser_ptr_->get()->Invoke(
|
||||
internal, channel, std::move(message),
|
||||
base::BindOnce(
|
||||
[](electron::util::Promise<blink::CloneableMessage> p,
|
||||
blink::CloneableMessage result) { p.ResolveWithGin(result); },
|
||||
[](gin_helper::Promise<blink::CloneableMessage> p,
|
||||
blink::CloneableMessage result) { p.Resolve(result); },
|
||||
std::move(p)));
|
||||
|
||||
return handle;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue