refactor: make util::Promise type safe when chaining in native (#19809)

* refactor: make util::Promise type safe when chaining in native

* fixup! refactor: make util::Promise type safe when chaining in native

* chore: remove spare brackets
This commit is contained in:
Samuel Attard 2019-08-22 17:03:28 -07:00 committed by GitHub
parent f7e3e1f97a
commit 6a3922d330
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 275 additions and 343 deletions

View file

@ -44,7 +44,7 @@ struct Converter<base::win::ShortcutOperation> {
namespace {
void OnOpenExternalFinished(electron::util::Promise promise,
void OnOpenExternalFinished(electron::util::Promise<void*> promise,
const std::string& error) {
if (error.empty())
promise.Resolve();
@ -53,7 +53,7 @@ void OnOpenExternalFinished(electron::util::Promise promise,
}
v8::Local<v8::Promise> OpenExternal(const GURL& url, mate::Arguments* args) {
electron::util::Promise promise(args->isolate());
electron::util::Promise<void*> promise(args->isolate());
v8::Local<v8::Promise> handle = promise.GetHandle();
platform_util::OpenExternalOptions options;

View file

@ -232,7 +232,7 @@ v8::Local<v8::Value> ElectronBindings::GetSystemMemoryInfo(
// static
v8::Local<v8::Promise> ElectronBindings::GetProcessMemoryInfo(
v8::Isolate* isolate) {
util::Promise promise(isolate);
util::Promise<mate::Dictionary> promise(isolate);
v8::Local<v8::Promise> handle = promise.GetHandle();
if (mate::Locker::IsBrowserProcess() && !Browser::Get()->is_ready()) {
@ -266,7 +266,7 @@ v8::Local<v8::Value> ElectronBindings::GetBlinkMemoryInfo(
// static
void ElectronBindings::DidReceiveMemoryDump(
v8::Global<v8::Context> context,
util::Promise promise,
util::Promise<mate::Dictionary> promise,
bool success,
std::unique_ptr<memory_instrumentation::GlobalMemoryDump> global_dump) {
v8::Isolate* isolate = promise.isolate();
@ -293,7 +293,7 @@ void ElectronBindings::DidReceiveMemoryDump(
#endif
dict.Set("private", osdump.private_footprint_kb);
dict.Set("shared", osdump.shared_footprint_kb);
promise.Resolve(dict.GetHandle());
promise.Resolve(dict);
resolved = true;
break;
}

View file

@ -71,7 +71,7 @@ class ElectronBindings {
static void DidReceiveMemoryDump(
v8::Global<v8::Context> context,
util::Promise promise,
util::Promise<mate::Dictionary> promise,
bool success,
std::unique_ptr<memory_instrumentation::GlobalMemoryDump> dump);