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
|
@ -532,9 +532,10 @@ int ImportIntoCertStore(CertificateManagerModel* model,
|
|||
}
|
||||
#endif
|
||||
|
||||
void OnIconDataAvailable(util::Promise<gfx::Image> promise, gfx::Image icon) {
|
||||
void OnIconDataAvailable(gin_helper::Promise<gfx::Image> promise,
|
||||
gfx::Image icon) {
|
||||
if (!icon.IsEmpty()) {
|
||||
promise.ResolveWithGin(icon);
|
||||
promise.Resolve(icon);
|
||||
} else {
|
||||
promise.RejectWithErrorMessage("Failed to get file icon.");
|
||||
}
|
||||
|
@ -1175,7 +1176,7 @@ JumpListResult App::SetJumpList(v8::Local<v8::Value> val,
|
|||
|
||||
v8::Local<v8::Promise> App::GetFileIcon(const base::FilePath& path,
|
||||
gin_helper::Arguments* args) {
|
||||
util::Promise<gfx::Image> promise(isolate());
|
||||
gin_helper::Promise<gfx::Image> promise(isolate());
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
base::FilePath normalized_path = path.NormalizePathSeparators();
|
||||
|
||||
|
@ -1193,7 +1194,7 @@ v8::Local<v8::Promise> App::GetFileIcon(const base::FilePath& path,
|
|||
gfx::Image* icon =
|
||||
icon_manager->LookupIconFromFilepath(normalized_path, icon_size);
|
||||
if (icon) {
|
||||
promise.ResolveWithGin(*icon);
|
||||
promise.Resolve(*icon);
|
||||
} else {
|
||||
icon_manager->LoadIcon(
|
||||
normalized_path, icon_size,
|
||||
|
@ -1285,7 +1286,7 @@ v8::Local<v8::Value> App::GetGPUFeatureStatus(v8::Isolate* isolate) {
|
|||
v8::Local<v8::Promise> App::GetGPUInfo(v8::Isolate* isolate,
|
||||
const std::string& info_type) {
|
||||
auto* const gpu_data_manager = content::GpuDataManagerImpl::GetInstance();
|
||||
util::Promise<base::DictionaryValue> promise(isolate);
|
||||
gin_helper::Promise<base::DictionaryValue> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
if (info_type != "basic" && info_type != "complete") {
|
||||
promise.RejectWithErrorMessage(
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/gin_helper/error_thrower.h"
|
||||
#include "shell/common/gin_helper/event_emitter.h"
|
||||
#include "shell/common/promise_util.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
|
||||
#if defined(USE_NSS_CERTS)
|
||||
#include "chrome/browser/certificate_manager_model.h"
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
#include "shell/common/gin_converters/file_path_converter.h"
|
||||
#include "shell/common/gin_converters/value_converter.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
#include "shell/common/promise_util.h"
|
||||
|
||||
using content::TracingController;
|
||||
|
||||
|
@ -63,14 +63,13 @@ base::Optional<base::FilePath> CreateTemporaryFileOnIO() {
|
|||
return base::make_optional(std::move(temp_file_path));
|
||||
}
|
||||
|
||||
void StopTracing(electron::util::Promise<base::FilePath> promise,
|
||||
void StopTracing(gin_helper::Promise<base::FilePath> promise,
|
||||
base::Optional<base::FilePath> file_path) {
|
||||
if (file_path) {
|
||||
auto endpoint = TracingController::CreateFileEndpoint(
|
||||
*file_path,
|
||||
base::AdaptCallbackForRepeating(base::BindOnce(
|
||||
&electron::util::Promise<base::FilePath>::ResolvePromise,
|
||||
std::move(promise), *file_path)));
|
||||
*file_path, base::AdaptCallbackForRepeating(base::BindOnce(
|
||||
&gin_helper::Promise<base::FilePath>::ResolvePromise,
|
||||
std::move(promise), *file_path)));
|
||||
TracingController::GetInstance()->StopTracing(endpoint);
|
||||
} else {
|
||||
promise.RejectWithErrorMessage(
|
||||
|
@ -79,7 +78,7 @@ void StopTracing(electron::util::Promise<base::FilePath> promise,
|
|||
}
|
||||
|
||||
v8::Local<v8::Promise> StopRecording(gin_helper::Arguments* args) {
|
||||
electron::util::Promise<base::FilePath> promise(args->isolate());
|
||||
gin_helper::Promise<base::FilePath> promise(args->isolate());
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
base::FilePath path;
|
||||
|
@ -99,12 +98,12 @@ v8::Local<v8::Promise> StopRecording(gin_helper::Arguments* args) {
|
|||
}
|
||||
|
||||
v8::Local<v8::Promise> GetCategories(v8::Isolate* isolate) {
|
||||
electron::util::Promise<const std::set<std::string>&> promise(isolate);
|
||||
gin_helper::Promise<const std::set<std::string>&> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
// Note: This method always succeeds.
|
||||
TracingController::GetInstance()->GetCategories(base::BindOnce(
|
||||
electron::util::Promise<const std::set<std::string>&>::ResolvePromise,
|
||||
gin_helper::Promise<const std::set<std::string>&>::ResolvePromise,
|
||||
std::move(promise)));
|
||||
|
||||
return handle;
|
||||
|
@ -113,35 +112,35 @@ v8::Local<v8::Promise> GetCategories(v8::Isolate* isolate) {
|
|||
v8::Local<v8::Promise> StartTracing(
|
||||
v8::Isolate* isolate,
|
||||
const base::trace_event::TraceConfig& trace_config) {
|
||||
electron::util::Promise<void*> promise(isolate);
|
||||
gin_helper::Promise<void> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
if (!TracingController::GetInstance()->StartTracing(
|
||||
trace_config,
|
||||
base::BindOnce(electron::util::Promise<void*>::ResolveEmptyPromise,
|
||||
base::BindOnce(gin_helper::Promise<void>::ResolvePromise,
|
||||
std::move(promise)))) {
|
||||
// If StartTracing returns false, that means it didn't invoke its callback.
|
||||
// Return an already-resolved promise and abandon the previous promise (it
|
||||
// was std::move()d into the StartTracing callback and has been deleted by
|
||||
// this point).
|
||||
return electron::util::Promise<void*>::ResolvedPromise(isolate);
|
||||
return gin_helper::Promise<void>::ResolvedPromise(isolate);
|
||||
}
|
||||
return handle;
|
||||
}
|
||||
|
||||
void OnTraceBufferUsageAvailable(
|
||||
electron::util::Promise<gin_helper::Dictionary> promise,
|
||||
gin_helper::Promise<gin_helper::Dictionary> promise,
|
||||
float percent_full,
|
||||
size_t approximate_count) {
|
||||
gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(promise.isolate());
|
||||
dict.Set("percentage", percent_full);
|
||||
dict.Set("value", approximate_count);
|
||||
|
||||
promise.ResolveWithGin(dict);
|
||||
promise.Resolve(dict);
|
||||
}
|
||||
|
||||
v8::Local<v8::Promise> GetTraceBufferUsage(v8::Isolate* isolate) {
|
||||
electron::util::Promise<gin_helper::Dictionary> promise(isolate);
|
||||
gin_helper::Promise<gin_helper::Dictionary> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
// Note: This method always succeeds.
|
||||
|
|
|
@ -121,18 +121,18 @@ bool MatchesCookie(const base::Value& filter,
|
|||
|
||||
// Remove cookies from |list| not matching |filter|, and pass it to |callback|.
|
||||
void FilterCookies(const base::Value& filter,
|
||||
util::Promise<net::CookieList> promise,
|
||||
gin_helper::Promise<net::CookieList> promise,
|
||||
const net::CookieList& cookies) {
|
||||
net::CookieList result;
|
||||
for (const auto& cookie : cookies) {
|
||||
if (MatchesCookie(filter, cookie))
|
||||
result.push_back(cookie);
|
||||
}
|
||||
promise.ResolveWithGin(result);
|
||||
promise.Resolve(result);
|
||||
}
|
||||
|
||||
void FilterCookieWithStatuses(const base::Value& filter,
|
||||
util::Promise<net::CookieList> promise,
|
||||
gin_helper::Promise<net::CookieList> promise,
|
||||
const net::CookieStatusList& list,
|
||||
const net::CookieStatusList& excluded_list) {
|
||||
FilterCookies(filter, std::move(promise),
|
||||
|
@ -176,7 +176,7 @@ Cookies::Cookies(v8::Isolate* isolate, AtomBrowserContext* browser_context)
|
|||
Cookies::~Cookies() = default;
|
||||
|
||||
v8::Local<v8::Promise> Cookies::Get(const gin_helper::Dictionary& filter) {
|
||||
util::Promise<net::CookieList> promise(isolate());
|
||||
gin_helper::Promise<net::CookieList> promise(isolate());
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
auto* storage_partition = content::BrowserContext::GetDefaultStoragePartition(
|
||||
|
@ -208,7 +208,7 @@ v8::Local<v8::Promise> Cookies::Get(const gin_helper::Dictionary& filter) {
|
|||
|
||||
v8::Local<v8::Promise> Cookies::Remove(const GURL& url,
|
||||
const std::string& name) {
|
||||
util::Promise<void*> promise(isolate());
|
||||
gin_helper::Promise<void> promise(isolate());
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
auto cookie_deletion_filter = network::mojom::CookieDeletionFilter::New();
|
||||
|
@ -222,8 +222,8 @@ v8::Local<v8::Promise> Cookies::Remove(const GURL& url,
|
|||
manager->DeleteCookies(
|
||||
std::move(cookie_deletion_filter),
|
||||
base::BindOnce(
|
||||
[](util::Promise<void*> promise, uint32_t num_deleted) {
|
||||
util::Promise<void*>::ResolveEmptyPromise(std::move(promise));
|
||||
[](gin_helper::Promise<void> promise, uint32_t num_deleted) {
|
||||
gin_helper::Promise<void>::ResolvePromise(std::move(promise));
|
||||
},
|
||||
std::move(promise)));
|
||||
|
||||
|
@ -231,7 +231,7 @@ v8::Local<v8::Promise> Cookies::Remove(const GURL& url,
|
|||
}
|
||||
|
||||
v8::Local<v8::Promise> Cookies::Set(base::DictionaryValue details) {
|
||||
util::Promise<void*> promise(isolate());
|
||||
gin_helper::Promise<void> promise(isolate());
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
const std::string* url_string = details.FindStringKey("url");
|
||||
|
@ -296,7 +296,7 @@ v8::Local<v8::Promise> Cookies::Set(base::DictionaryValue details) {
|
|||
manager->SetCanonicalCookie(
|
||||
*canonical_cookie, url.scheme(), options,
|
||||
base::BindOnce(
|
||||
[](util::Promise<void*> promise,
|
||||
[](gin_helper::Promise<void> promise,
|
||||
net::CanonicalCookie::CookieInclusionStatus status) {
|
||||
if (status.IsInclude()) {
|
||||
promise.Resolve();
|
||||
|
@ -310,7 +310,7 @@ v8::Local<v8::Promise> Cookies::Set(base::DictionaryValue details) {
|
|||
}
|
||||
|
||||
v8::Local<v8::Promise> Cookies::FlushStore() {
|
||||
util::Promise<void*> promise(isolate());
|
||||
gin_helper::Promise<void> promise(isolate());
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
auto* storage_partition = content::BrowserContext::GetDefaultStoragePartition(
|
||||
|
@ -318,7 +318,7 @@ v8::Local<v8::Promise> Cookies::FlushStore() {
|
|||
auto* manager = storage_partition->GetCookieManagerForBrowserProcess();
|
||||
|
||||
manager->FlushCookieStore(base::BindOnce(
|
||||
util::Promise<void*>::ResolveEmptyPromise, std::move(promise)));
|
||||
gin_helper::Promise<void>::ResolvePromise, std::move(promise)));
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
#include "gin/handle.h"
|
||||
#include "net/cookies/canonical_cookie.h"
|
||||
#include "net/cookies/cookie_change_dispatcher.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
#include "shell/common/gin_helper/trackable_object.h"
|
||||
#include "shell/common/promise_util.h"
|
||||
|
||||
namespace base {
|
||||
class DictionaryValue;
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
#include "mojo/public/cpp/system/data_pipe.h"
|
||||
#include "mojo/public/cpp/system/simple_watcher.h"
|
||||
#include "net/base/net_errors.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
#include "shell/common/key_weak_map.h"
|
||||
#include "shell/common/promise_util.h"
|
||||
|
||||
#include "shell/common/node_includes.h"
|
||||
|
||||
|
@ -32,7 +32,7 @@ KeyWeakMap<std::string> g_weak_map;
|
|||
// Utility class to read from data pipe.
|
||||
class DataPipeReader {
|
||||
public:
|
||||
DataPipeReader(util::Promise<v8::Local<v8::Value>> promise,
|
||||
DataPipeReader(gin_helper::Promise<v8::Local<v8::Value>> promise,
|
||||
mojo::Remote<network::mojom::DataPipeGetter> data_pipe_getter)
|
||||
: promise_(std::move(promise)),
|
||||
data_pipe_getter_(std::move(data_pipe_getter)),
|
||||
|
@ -116,7 +116,7 @@ class DataPipeReader {
|
|||
delete static_cast<DataPipeReader*>(self);
|
||||
}
|
||||
|
||||
util::Promise<v8::Local<v8::Value>> promise_;
|
||||
gin_helper::Promise<v8::Local<v8::Value>> promise_;
|
||||
|
||||
mojo::Remote<network::mojom::DataPipeGetter> data_pipe_getter_;
|
||||
mojo::ScopedDataPipeConsumerHandle data_pipe_;
|
||||
|
@ -148,7 +148,7 @@ DataPipeHolder::DataPipeHolder(const network::DataElement& element)
|
|||
DataPipeHolder::~DataPipeHolder() = default;
|
||||
|
||||
v8::Local<v8::Promise> DataPipeHolder::ReadAll(v8::Isolate* isolate) {
|
||||
util::Promise<v8::Local<v8::Value>> promise(isolate);
|
||||
gin_helper::Promise<v8::Local<v8::Value>> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
if (!data_pipe_) {
|
||||
promise.RejectWithErrorMessage("Could not get blob data");
|
||||
|
|
|
@ -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_) {
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
#include "content/public/browser/devtools_agent_host_client.h"
|
||||
#include "content/public/browser/web_contents_observer.h"
|
||||
#include "gin/handle.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
#include "shell/common/gin_helper/trackable_object.h"
|
||||
#include "shell/common/promise_util.h"
|
||||
|
||||
namespace content {
|
||||
class DevToolsAgentHost;
|
||||
|
@ -51,7 +51,7 @@ class Debugger : public gin_helper::TrackableObject<Debugger>,
|
|||
|
||||
private:
|
||||
using PendingRequestMap =
|
||||
std::map<int, electron::util::Promise<base::DictionaryValue>>;
|
||||
std::map<int, gin_helper::Promise<base::DictionaryValue>>;
|
||||
|
||||
void Attach(gin_helper::Arguments* args);
|
||||
bool IsAttached();
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
#include "shell/common/gin_converters/native_window_converter.h"
|
||||
#include "shell/common/gin_converters/net_converter.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
#include "shell/common/promise_util.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -25,24 +25,23 @@ int ShowMessageBoxSync(const electron::MessageBoxSettings& settings) {
|
|||
return electron::ShowMessageBoxSync(settings);
|
||||
}
|
||||
|
||||
void ResolvePromiseObject(
|
||||
electron::util::Promise<gin_helper::Dictionary> promise,
|
||||
int result,
|
||||
bool checkbox_checked) {
|
||||
void ResolvePromiseObject(gin_helper::Promise<gin_helper::Dictionary> promise,
|
||||
int result,
|
||||
bool checkbox_checked) {
|
||||
v8::Isolate* isolate = promise.isolate();
|
||||
gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
|
||||
|
||||
dict.Set("response", result);
|
||||
dict.Set("checkboxChecked", checkbox_checked);
|
||||
|
||||
promise.ResolveWithGin(dict);
|
||||
promise.Resolve(dict);
|
||||
}
|
||||
|
||||
v8::Local<v8::Promise> ShowMessageBox(
|
||||
const electron::MessageBoxSettings& settings,
|
||||
gin::Arguments* args) {
|
||||
v8::Isolate* isolate = args->isolate();
|
||||
electron::util::Promise<gin_helper::Dictionary> promise(isolate);
|
||||
gin_helper::Promise<gin_helper::Dictionary> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
electron::ShowMessageBox(
|
||||
|
@ -61,7 +60,7 @@ void ShowOpenDialogSync(const file_dialog::DialogSettings& settings,
|
|||
v8::Local<v8::Promise> ShowOpenDialog(
|
||||
const file_dialog::DialogSettings& settings,
|
||||
gin::Arguments* args) {
|
||||
electron::util::Promise<gin_helper::Dictionary> promise(args->isolate());
|
||||
gin_helper::Promise<gin_helper::Dictionary> promise(args->isolate());
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
file_dialog::ShowOpenDialog(settings, std::move(promise));
|
||||
return handle;
|
||||
|
@ -77,7 +76,7 @@ void ShowSaveDialogSync(const file_dialog::DialogSettings& settings,
|
|||
v8::Local<v8::Promise> ShowSaveDialog(
|
||||
const file_dialog::DialogSettings& settings,
|
||||
gin::Arguments* args) {
|
||||
electron::util::Promise<gin_helper::Dictionary> promise(args->isolate());
|
||||
gin_helper::Promise<gin_helper::Dictionary> promise(args->isolate());
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
file_dialog::ShowSaveDialog(settings, std::move(promise));
|
||||
|
|
|
@ -104,7 +104,7 @@ v8::Local<v8::Promise> InAppPurchase::PurchaseProduct(
|
|||
const std::string& product_id,
|
||||
gin::Arguments* args) {
|
||||
v8::Isolate* isolate = args->isolate();
|
||||
electron::util::Promise<bool> promise(isolate);
|
||||
gin_helper::Promise<bool> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
int quantity = 1;
|
||||
|
@ -112,7 +112,8 @@ v8::Local<v8::Promise> InAppPurchase::PurchaseProduct(
|
|||
|
||||
in_app_purchase::PurchaseProduct(
|
||||
product_id, quantity,
|
||||
base::BindOnce(util::Promise<bool>::ResolvePromise, std::move(promise)));
|
||||
base::BindOnce(gin_helper::Promise<bool>::ResolvePromise,
|
||||
std::move(promise)));
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
@ -121,15 +122,14 @@ v8::Local<v8::Promise> InAppPurchase::GetProducts(
|
|||
const std::vector<std::string>& productIDs,
|
||||
gin::Arguments* args) {
|
||||
v8::Isolate* isolate = args->isolate();
|
||||
electron::util::Promise<std::vector<in_app_purchase::Product>> promise(
|
||||
isolate);
|
||||
gin_helper::Promise<std::vector<in_app_purchase::Product>> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
in_app_purchase::GetProducts(
|
||||
productIDs,
|
||||
base::BindOnce(
|
||||
util::Promise<std::vector<in_app_purchase::Product>>::ResolvePromise,
|
||||
std::move(promise)));
|
||||
base::BindOnce(gin_helper::Promise<
|
||||
std::vector<in_app_purchase::Product>>::ResolvePromise,
|
||||
std::move(promise)));
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "shell/browser/mac/in_app_purchase_observer.h"
|
||||
#include "shell/browser/mac/in_app_purchase_product.h"
|
||||
#include "shell/common/gin_helper/event_emitter.h"
|
||||
#include "shell/common/promise_util.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
|
|
|
@ -62,7 +62,8 @@ base::File OpenFileForWriting(base::FilePath path) {
|
|||
base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE);
|
||||
}
|
||||
|
||||
void ResolvePromiseWithNetError(util::Promise<void*> promise, int32_t error) {
|
||||
void ResolvePromiseWithNetError(gin_helper::Promise<void> promise,
|
||||
int32_t error) {
|
||||
if (error == net::OK) {
|
||||
promise.Resolve();
|
||||
} else {
|
||||
|
@ -117,7 +118,8 @@ v8::Local<v8::Promise> NetLog::StartLogging(base::FilePath log_path,
|
|||
return v8::Local<v8::Promise>();
|
||||
}
|
||||
|
||||
pending_start_promise_ = base::make_optional<util::Promise<void*>>(isolate());
|
||||
pending_start_promise_ =
|
||||
base::make_optional<gin_helper::Promise<void>>(isolate());
|
||||
v8::Local<v8::Promise> handle = pending_start_promise_->GetHandle();
|
||||
|
||||
auto command_line_string =
|
||||
|
@ -187,7 +189,7 @@ bool NetLog::IsCurrentlyLogging() const {
|
|||
}
|
||||
|
||||
v8::Local<v8::Promise> NetLog::StopLogging(gin_helper::Arguments* args) {
|
||||
util::Promise<void*> promise(isolate());
|
||||
gin_helper::Promise<void> promise(isolate());
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
if (net_log_exporter_) {
|
||||
|
@ -197,8 +199,8 @@ v8::Local<v8::Promise> NetLog::StopLogging(gin_helper::Arguments* args) {
|
|||
net_log_exporter_->Stop(
|
||||
base::Value(base::Value::Type::DICTIONARY),
|
||||
base::BindOnce(
|
||||
[](network::mojom::NetLogExporterPtr, util::Promise<void*> promise,
|
||||
int32_t error) {
|
||||
[](network::mojom::NetLogExporterPtr,
|
||||
gin_helper::Promise<void> promise, int32_t error) {
|
||||
ResolvePromiseWithNetError(std::move(promise), error);
|
||||
},
|
||||
std::move(net_log_exporter_), std::move(promise)));
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
#include "base/values.h"
|
||||
#include "gin/handle.h"
|
||||
#include "services/network/public/mojom/net_log.mojom.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
#include "shell/common/gin_helper/trackable_object.h"
|
||||
#include "shell/common/promise_util.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
|
@ -53,7 +53,7 @@ class NetLog : public gin_helper::TrackableObject<NetLog> {
|
|||
|
||||
network::mojom::NetLogExporterPtr net_log_exporter_;
|
||||
|
||||
base::Optional<util::Promise<void*>> pending_start_promise_;
|
||||
base::Optional<gin_helper::Promise<void>> pending_start_promise_;
|
||||
|
||||
scoped_refptr<base::TaskRunner> file_task_runner_;
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
#include "shell/common/gin_converters/net_converter.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/gin_helper/object_template_builder.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
#include "shell/common/options_switches.h"
|
||||
#include "shell/common/promise_util.h"
|
||||
#include "url/url_util.h"
|
||||
|
||||
namespace {
|
||||
|
@ -223,7 +223,7 @@ v8::Local<v8::Promise> Protocol::IsProtocolHandled(const std::string& scheme,
|
|||
"protocol.isProtocolRegistered or protocol.isProtocolIntercepted "
|
||||
"instead.",
|
||||
"ProtocolDeprecateIsProtocolHandled");
|
||||
return util::Promise<bool>::ResolvedPromise(
|
||||
return gin_helper::Promise<bool>::ResolvedPromise(
|
||||
isolate(), IsProtocolRegistered(scheme) ||
|
||||
IsProtocolIntercepted(scheme) ||
|
||||
// The |isProtocolHandled| should return true for builtin
|
||||
|
|
|
@ -246,14 +246,14 @@ void Session::OnDownloadCreated(content::DownloadManager* manager,
|
|||
|
||||
v8::Local<v8::Promise> Session::ResolveProxy(gin_helper::Arguments* args) {
|
||||
v8::Isolate* isolate = args->isolate();
|
||||
util::Promise<std::string> promise(isolate);
|
||||
gin_helper::Promise<std::string> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
GURL url;
|
||||
args->GetNext(&url);
|
||||
|
||||
browser_context_->GetResolveProxyHelper()->ResolveProxy(
|
||||
url, base::BindOnce(util::Promise<std::string>::ResolvePromise,
|
||||
url, base::BindOnce(gin_helper::Promise<std::string>::ResolvePromise,
|
||||
std::move(promise)));
|
||||
|
||||
return handle;
|
||||
|
@ -261,7 +261,7 @@ v8::Local<v8::Promise> Session::ResolveProxy(gin_helper::Arguments* args) {
|
|||
|
||||
v8::Local<v8::Promise> Session::GetCacheSize() {
|
||||
auto* isolate = v8::Isolate::GetCurrent();
|
||||
util::Promise<int64_t> promise(isolate);
|
||||
gin_helper::Promise<int64_t> promise(isolate);
|
||||
auto handle = promise.GetHandle();
|
||||
|
||||
content::BrowserContext::GetDefaultStoragePartition(browser_context_.get())
|
||||
|
@ -269,7 +269,7 @@ v8::Local<v8::Promise> Session::GetCacheSize() {
|
|||
->ComputeHttpCacheSize(
|
||||
base::Time(), base::Time::Max(),
|
||||
base::BindOnce(
|
||||
[](util::Promise<int64_t> promise, bool is_upper_bound,
|
||||
[](gin_helper::Promise<int64_t> promise, bool is_upper_bound,
|
||||
int64_t size_or_error) {
|
||||
if (size_or_error < 0) {
|
||||
promise.RejectWithErrorMessage(
|
||||
|
@ -285,13 +285,13 @@ v8::Local<v8::Promise> Session::GetCacheSize() {
|
|||
|
||||
v8::Local<v8::Promise> Session::ClearCache() {
|
||||
auto* isolate = v8::Isolate::GetCurrent();
|
||||
util::Promise<void*> promise(isolate);
|
||||
gin_helper::Promise<void> promise(isolate);
|
||||
auto handle = promise.GetHandle();
|
||||
|
||||
content::BrowserContext::GetDefaultStoragePartition(browser_context_.get())
|
||||
->GetNetworkContext()
|
||||
->ClearHttpCache(base::Time(), base::Time::Max(), nullptr,
|
||||
base::BindOnce(util::Promise<void*>::ResolveEmptyPromise,
|
||||
base::BindOnce(gin_helper::Promise<void>::ResolvePromise,
|
||||
std::move(promise)));
|
||||
|
||||
return handle;
|
||||
|
@ -299,7 +299,7 @@ v8::Local<v8::Promise> Session::ClearCache() {
|
|||
|
||||
v8::Local<v8::Promise> Session::ClearStorageData(gin_helper::Arguments* args) {
|
||||
v8::Isolate* isolate = args->isolate();
|
||||
util::Promise<void*> promise(isolate);
|
||||
gin_helper::Promise<void> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
ClearStorageDataOptions options;
|
||||
|
@ -316,7 +316,7 @@ v8::Local<v8::Promise> Session::ClearStorageData(gin_helper::Arguments* args) {
|
|||
storage_partition->ClearData(
|
||||
options.storage_types, options.quota_types, options.origin, base::Time(),
|
||||
base::Time::Max(),
|
||||
base::BindOnce(util::Promise<void*>::ResolveEmptyPromise,
|
||||
base::BindOnce(gin_helper::Promise<void>::ResolvePromise,
|
||||
std::move(promise)));
|
||||
return handle;
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ void Session::FlushStorageData() {
|
|||
|
||||
v8::Local<v8::Promise> Session::SetProxy(gin_helper::Arguments* args) {
|
||||
v8::Isolate* isolate = args->isolate();
|
||||
util::Promise<void*> promise(isolate);
|
||||
gin_helper::Promise<void> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
gin_helper::Dictionary options;
|
||||
|
@ -362,7 +362,7 @@ v8::Local<v8::Promise> Session::SetProxy(gin_helper::Arguments* args) {
|
|||
}
|
||||
|
||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||
FROM_HERE, base::BindOnce(util::Promise<void*>::ResolveEmptyPromise,
|
||||
FROM_HERE, base::BindOnce(gin_helper::Promise<void>::ResolvePromise,
|
||||
std::move(promise)));
|
||||
|
||||
return handle;
|
||||
|
@ -464,13 +464,13 @@ void Session::SetPermissionCheckHandler(v8::Local<v8::Value> val,
|
|||
v8::Local<v8::Promise> Session::ClearHostResolverCache(
|
||||
gin_helper::Arguments* args) {
|
||||
v8::Isolate* isolate = args->isolate();
|
||||
util::Promise<void*> promise(isolate);
|
||||
gin_helper::Promise<void> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
content::BrowserContext::GetDefaultStoragePartition(browser_context_.get())
|
||||
->GetNetworkContext()
|
||||
->ClearHostCache(nullptr,
|
||||
base::BindOnce(util::Promise<void*>::ResolveEmptyPromise,
|
||||
base::BindOnce(gin_helper::Promise<void>::ResolvePromise,
|
||||
std::move(promise)));
|
||||
|
||||
return handle;
|
||||
|
@ -478,14 +478,14 @@ v8::Local<v8::Promise> Session::ClearHostResolverCache(
|
|||
|
||||
v8::Local<v8::Promise> Session::ClearAuthCache() {
|
||||
auto* isolate = v8::Isolate::GetCurrent();
|
||||
util::Promise<void*> promise(isolate);
|
||||
gin_helper::Promise<void> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
content::BrowserContext::GetDefaultStoragePartition(browser_context_.get())
|
||||
->GetNetworkContext()
|
||||
->ClearHttpAuthCache(
|
||||
base::Time(),
|
||||
base::BindOnce(util::Promise<void*>::ResolveEmptyPromise,
|
||||
base::BindOnce(gin_helper::Promise<void>::ResolvePromise,
|
||||
std::move(promise)));
|
||||
|
||||
return handle;
|
||||
|
@ -515,7 +515,7 @@ v8::Local<v8::Promise> Session::GetBlobData(v8::Isolate* isolate,
|
|||
const std::string& uuid) {
|
||||
gin::Handle<DataPipeHolder> holder = DataPipeHolder::From(isolate, uuid);
|
||||
if (holder.IsEmpty()) {
|
||||
util::Promise<v8::Local<v8::Value>> promise(isolate);
|
||||
gin_helper::Promise<v8::Local<v8::Value>> promise(isolate);
|
||||
promise.RejectWithErrorMessage("Could not get blob data handle");
|
||||
return promise.GetHandle();
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
#include "electron/buildflags/buildflags.h"
|
||||
#include "gin/handle.h"
|
||||
#include "shell/browser/net/resolve_proxy_helper.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
#include "shell/common/gin_helper/trackable_object.h"
|
||||
#include "shell/common/promise_util.h"
|
||||
|
||||
class GURL;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "gin/handle.h"
|
||||
#include "shell/common/gin_helper/error_thrower.h"
|
||||
#include "shell/common/gin_helper/event_emitter.h"
|
||||
#include "shell/common/promise_util.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "shell/browser/browser.h"
|
||||
|
|
|
@ -444,7 +444,7 @@ bool SystemPreferences::CanPromptTouchID() {
|
|||
v8::Local<v8::Promise> SystemPreferences::PromptTouchID(
|
||||
v8::Isolate* isolate,
|
||||
const std::string& reason) {
|
||||
util::Promise<void*> promise(isolate);
|
||||
gin_helper::Promise<void> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
if (@available(macOS 10.12.2, *)) {
|
||||
|
@ -461,7 +461,7 @@ v8::Local<v8::Promise> SystemPreferences::PromptTouchID(
|
|||
scoped_refptr<base::SequencedTaskRunner> runner =
|
||||
base::SequencedTaskRunnerHandle::Get();
|
||||
|
||||
__block util::Promise<void*> p = std::move(promise);
|
||||
__block gin_helper::Promise<void> p = std::move(promise);
|
||||
[context
|
||||
evaluateAccessControl:access_control
|
||||
operation:LAAccessControlOperationUseKeySign
|
||||
|
@ -473,13 +473,13 @@ v8::Local<v8::Promise> SystemPreferences::PromptTouchID(
|
|||
runner->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(
|
||||
util::Promise<void*>::RejectPromise,
|
||||
gin_helper::Promise<void>::RejectPromise,
|
||||
std::move(p), std::move(err_msg)));
|
||||
} else {
|
||||
runner->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(
|
||||
util::Promise<void*>::ResolveEmptyPromise,
|
||||
gin_helper::Promise<void>::ResolvePromise,
|
||||
std::move(p)));
|
||||
}
|
||||
}];
|
||||
|
@ -606,12 +606,12 @@ std::string SystemPreferences::GetMediaAccessStatus(
|
|||
v8::Local<v8::Promise> SystemPreferences::AskForMediaAccess(
|
||||
v8::Isolate* isolate,
|
||||
const std::string& media_type) {
|
||||
util::Promise<bool> promise(isolate);
|
||||
gin_helper::Promise<bool> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
if (auto type = ParseMediaType(media_type)) {
|
||||
if (@available(macOS 10.14, *)) {
|
||||
__block util::Promise<bool> p = std::move(promise);
|
||||
__block gin_helper::Promise<bool> p = std::move(promise);
|
||||
[AVCaptureDevice requestAccessForMediaType:type
|
||||
completionHandler:^(BOOL granted) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
|
|
|
@ -320,10 +320,10 @@ namespace api {
|
|||
namespace {
|
||||
|
||||
// Called when CapturePage is done.
|
||||
void OnCapturePageDone(util::Promise<gfx::Image> promise,
|
||||
void OnCapturePageDone(gin_helper::Promise<gfx::Image> promise,
|
||||
const SkBitmap& bitmap) {
|
||||
// Hack to enable transparency in captured image
|
||||
promise.ResolveWithGin(gfx::Image::CreateFrom1xBitmap(bitmap));
|
||||
promise.Resolve(gfx::Image::CreateFrom1xBitmap(bitmap));
|
||||
}
|
||||
|
||||
base::Optional<base::TimeDelta> GetCursorBlinkInterval() {
|
||||
|
@ -1494,7 +1494,7 @@ std::string WebContents::GetUserAgent() {
|
|||
v8::Local<v8::Promise> WebContents::SavePage(
|
||||
const base::FilePath& full_file_path,
|
||||
const content::SavePageType& save_type) {
|
||||
util::Promise<void*> promise(isolate());
|
||||
gin_helper::Promise<void> promise(isolate());
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
auto* handler = new SavePageHandler(web_contents(), std::move(promise));
|
||||
|
@ -1864,7 +1864,7 @@ std::vector<printing::PrinterBasicInfo> WebContents::GetPrinterList() {
|
|||
}
|
||||
|
||||
v8::Local<v8::Promise> WebContents::PrintToPDF(base::DictionaryValue settings) {
|
||||
util::Promise<v8::Local<v8::Value>> promise(isolate());
|
||||
gin_helper::Promise<v8::Local<v8::Value>> promise(isolate());
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
PrintPreviewMessageHandler::FromWebContents(web_contents())
|
||||
->PrintToPDF(std::move(settings), std::move(promise));
|
||||
|
@ -2167,7 +2167,7 @@ void WebContents::StartDrag(const gin_helper::Dictionary& item,
|
|||
|
||||
v8::Local<v8::Promise> WebContents::CapturePage(gin_helper::Arguments* args) {
|
||||
gfx::Rect rect;
|
||||
util::Promise<gfx::Image> promise(isolate());
|
||||
gin_helper::Promise<gfx::Image> promise(isolate());
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
// get rect arguments if they exist
|
||||
|
@ -2175,7 +2175,7 @@ v8::Local<v8::Promise> WebContents::CapturePage(gin_helper::Arguments* args) {
|
|||
|
||||
auto* const view = web_contents()->GetRenderWidgetHostView();
|
||||
if (!view) {
|
||||
promise.ResolveWithGin(gfx::Image());
|
||||
promise.Resolve(gfx::Image());
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
@ -2433,7 +2433,7 @@ void WebContents::GrantOriginAccess(const GURL& url) {
|
|||
|
||||
v8::Local<v8::Promise> WebContents::TakeHeapSnapshot(
|
||||
const base::FilePath& file_path) {
|
||||
util::Promise<void*> promise(isolate());
|
||||
gin_helper::Promise<void> promise(isolate());
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
|
@ -2462,7 +2462,7 @@ v8::Local<v8::Promise> WebContents::TakeHeapSnapshot(
|
|||
mojo::WrapPlatformFile(file.TakePlatformFile()),
|
||||
base::BindOnce(
|
||||
[](mojo::AssociatedRemote<mojom::ElectronRenderer>* ep,
|
||||
util::Promise<void*> promise, bool success) {
|
||||
gin_helper::Promise<void> promise, bool success) {
|
||||
if (success) {
|
||||
promise.Resolve();
|
||||
} else {
|
||||
|
|
|
@ -47,7 +47,7 @@ void GPUInfoManager::ProcessCompleteInfo() {
|
|||
// We have received the complete information, resolve all promises that
|
||||
// were waiting for this info.
|
||||
for (auto& promise : complete_info_promise_set_) {
|
||||
promise.ResolveWithGin(*result);
|
||||
promise.Resolve(*result);
|
||||
}
|
||||
complete_info_promise_set_.clear();
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ void GPUInfoManager::OnGpuInfoUpdate() {
|
|||
|
||||
// Should be posted to the task runner
|
||||
void GPUInfoManager::CompleteInfoFetcher(
|
||||
util::Promise<base::DictionaryValue> promise) {
|
||||
gin_helper::Promise<base::DictionaryValue> promise) {
|
||||
complete_info_promise_set_.emplace_back(std::move(promise));
|
||||
|
||||
if (NeedsCompleteGpuInfoCollection()) {
|
||||
|
@ -75,7 +75,7 @@ void GPUInfoManager::CompleteInfoFetcher(
|
|||
}
|
||||
|
||||
void GPUInfoManager::FetchCompleteInfo(
|
||||
util::Promise<base::DictionaryValue> promise) {
|
||||
gin_helper::Promise<base::DictionaryValue> promise) {
|
||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||
FROM_HERE, base::BindOnce(&GPUInfoManager::CompleteInfoFetcher,
|
||||
base::Unretained(this), std::move(promise)));
|
||||
|
@ -84,10 +84,10 @@ void GPUInfoManager::FetchCompleteInfo(
|
|||
// This fetches the info synchronously, so no need to post to the task queue.
|
||||
// There cannot be multiple promises as they are resolved synchronously.
|
||||
void GPUInfoManager::FetchBasicInfo(
|
||||
util::Promise<base::DictionaryValue> promise) {
|
||||
gin_helper::Promise<base::DictionaryValue> promise) {
|
||||
gpu::GPUInfo gpu_info;
|
||||
CollectBasicGraphicsInfo(&gpu_info);
|
||||
promise.ResolveWithGin(*EnumerateGPUInfo(gpu_info));
|
||||
promise.Resolve(*EnumerateGPUInfo(gpu_info));
|
||||
}
|
||||
|
||||
std::unique_ptr<base::DictionaryValue> GPUInfoManager::EnumerateGPUInfo(
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "content/browser/gpu/gpu_data_manager_impl.h" // nogncheck
|
||||
#include "content/public/browser/gpu_data_manager.h"
|
||||
#include "content/public/browser/gpu_data_manager_observer.h"
|
||||
#include "shell/common/promise_util.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
|
@ -24,8 +24,8 @@ class GPUInfoManager : public content::GpuDataManagerObserver {
|
|||
GPUInfoManager();
|
||||
~GPUInfoManager() override;
|
||||
bool NeedsCompleteGpuInfoCollection() const;
|
||||
void FetchCompleteInfo(util::Promise<base::DictionaryValue> promise);
|
||||
void FetchBasicInfo(util::Promise<base::DictionaryValue> promise);
|
||||
void FetchCompleteInfo(gin_helper::Promise<base::DictionaryValue> promise);
|
||||
void FetchBasicInfo(gin_helper::Promise<base::DictionaryValue> promise);
|
||||
void OnGpuInfoUpdate() override;
|
||||
|
||||
private:
|
||||
|
@ -33,12 +33,13 @@ class GPUInfoManager : public content::GpuDataManagerObserver {
|
|||
gpu::GPUInfo gpu_info) const;
|
||||
|
||||
// These should be posted to the task queue
|
||||
void CompleteInfoFetcher(util::Promise<base::DictionaryValue> promise);
|
||||
void CompleteInfoFetcher(gin_helper::Promise<base::DictionaryValue> promise);
|
||||
void ProcessCompleteInfo();
|
||||
|
||||
// This set maintains all the promises that should be fulfilled
|
||||
// once we have the complete information data
|
||||
std::vector<util::Promise<base::DictionaryValue>> complete_info_promise_set_;
|
||||
std::vector<gin_helper::Promise<base::DictionaryValue>>
|
||||
complete_info_promise_set_;
|
||||
content::GpuDataManager* gpu_data_manager_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(GPUInfoManager);
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace electron {
|
|||
namespace api {
|
||||
|
||||
SavePageHandler::SavePageHandler(content::WebContents* web_contents,
|
||||
util::Promise<void*> promise)
|
||||
gin_helper::Promise<void> promise)
|
||||
: web_contents_(web_contents), promise_(std::move(promise)) {}
|
||||
|
||||
SavePageHandler::~SavePageHandler() = default;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "components/download/public/common/download_item.h"
|
||||
#include "content/public/browser/download_manager.h"
|
||||
#include "content/public/browser/save_page_type.h"
|
||||
#include "shell/common/promise_util.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
#include "v8/include/v8.h"
|
||||
|
||||
namespace base {
|
||||
|
@ -30,7 +30,7 @@ class SavePageHandler : public content::DownloadManager::Observer,
|
|||
public download::DownloadItem::Observer {
|
||||
public:
|
||||
SavePageHandler(content::WebContents* web_contents,
|
||||
electron::util::Promise<void*> promise);
|
||||
gin_helper::Promise<void> promise);
|
||||
~SavePageHandler() override;
|
||||
|
||||
bool Handle(const base::FilePath& full_path,
|
||||
|
@ -47,7 +47,7 @@ class SavePageHandler : public content::DownloadManager::Observer,
|
|||
void OnDownloadUpdated(download::DownloadItem* item) override;
|
||||
|
||||
content::WebContents* web_contents_; // weak
|
||||
electron::util::Promise<void*> promise_;
|
||||
gin_helper::Promise<void> promise_;
|
||||
};
|
||||
|
||||
} // namespace api
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue