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

@ -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