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
|
@ -19,7 +19,7 @@
|
|||
|
||||
@interface TrustDelegate : NSObject {
|
||||
@private
|
||||
std::unique_ptr<electron::util::Promise<void*>> promise_;
|
||||
std::unique_ptr<gin_helper::Promise<void>> promise_;
|
||||
SFCertificateTrustPanel* panel_;
|
||||
scoped_refptr<net::X509Certificate> cert_;
|
||||
SecTrustRef trust_;
|
||||
|
@ -27,7 +27,7 @@
|
|||
SecPolicyRef sec_policy_;
|
||||
}
|
||||
|
||||
- (id)initWithPromise:(electron::util::Promise<void*>)promise
|
||||
- (id)initWithPromise:(gin_helper::Promise<void>)promise
|
||||
panel:(SFCertificateTrustPanel*)panel
|
||||
cert:(const scoped_refptr<net::X509Certificate>&)cert
|
||||
trust:(SecTrustRef)trust
|
||||
|
@ -51,14 +51,14 @@
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)initWithPromise:(electron::util::Promise<void*>)promise
|
||||
- (id)initWithPromise:(gin_helper::Promise<void>)promise
|
||||
panel:(SFCertificateTrustPanel*)panel
|
||||
cert:(const scoped_refptr<net::X509Certificate>&)cert
|
||||
trust:(SecTrustRef)trust
|
||||
certChain:(CFArrayRef)certChain
|
||||
secPolicy:(SecPolicyRef)secPolicy {
|
||||
if ((self = [super init])) {
|
||||
promise_.reset(new electron::util::Promise<void*>(std::move(promise)));
|
||||
promise_.reset(new gin_helper::Promise<void>(std::move(promise)));
|
||||
panel_ = panel;
|
||||
cert_ = cert;
|
||||
trust_ = trust;
|
||||
|
@ -90,7 +90,7 @@ v8::Local<v8::Promise> ShowCertificateTrust(
|
|||
const scoped_refptr<net::X509Certificate>& cert,
|
||||
const std::string& message) {
|
||||
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
||||
electron::util::Promise<void*> promise(isolate);
|
||||
gin_helper::Promise<void> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
auto* sec_policy = SecPolicyCreateBasicX509();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue