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:
Cheng Zhao 2019-11-01 15:10:32 +09:00 committed by GitHub
parent bff113760a
commit eaf2c61bef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
48 changed files with 483 additions and 479 deletions

View file

@ -21,8 +21,8 @@
#include "shell/browser/window_list.h"
#include "shell/common/application_info.h"
#include "shell/common/gin_helper/arguments.h"
#include "shell/common/gin_helper/promise.h"
#include "shell/common/platform_util.h"
#include "shell/common/promise_util.h"
#include "ui/gfx/image/image.h"
#include "url/gurl.h"
@ -314,7 +314,7 @@ bool Browser::DockIsVisible() {
}
v8::Local<v8::Promise> Browser::DockShow(v8::Isolate* isolate) {
util::Promise<void*> promise(isolate);
gin_helper::Promise<void> promise(isolate);
v8::Local<v8::Promise> handle = promise.GetHandle();
BOOL active = [[NSRunningApplication currentApplication] isActive];
@ -328,7 +328,7 @@ v8::Local<v8::Promise> Browser::DockShow(v8::Isolate* isolate) {
[app activateWithOptions:NSApplicationActivateIgnoringOtherApps];
break;
}
__block util::Promise<void*> p = std::move(promise);
__block gin_helper::Promise<void> p = std::move(promise);
dispatch_time_t one_ms = dispatch_time(DISPATCH_TIME_NOW, USEC_PER_SEC);
dispatch_after(one_ms, dispatch_get_main_queue(), ^{
TransformProcessType(&psn, kProcessTransformToForegroundApplication);