refactor: add promise helper and change whenReady to be native impl (#13115)

* Add promise helper and change whenReady to be native impl

* remove commented code

* add GetInner helper to dedupe promise code

* add Promise.reject helper to be consistent with JS

* fix linting

* update promise impl per feedback

* remove param name from unused isolate

* Use non-depreceated resolvers for promises

* Add thread dchecks for promise helper, intiialize promise pointer to nullptr
This commit is contained in:
Samuel Attard 2018-06-28 07:06:08 +10:00 committed by Charles Kerr
parent e9971173d4
commit 92588be2bd
8 changed files with 145 additions and 18 deletions

View file

@ -10,6 +10,7 @@
#include "atom/browser/browser_observer.h"
#include "atom/browser/window_list_observer.h"
#include "atom/common/promise_util.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/observer_list.h"
@ -245,6 +246,7 @@ class Browser : public WindowListObserver {
bool is_shutting_down() const { return is_shutdown_; }
bool is_quiting() const { return is_quiting_; }
bool is_ready() const { return is_ready_; }
util::Promise* WhenReady(v8::Isolate* isolate);
protected:
// Returns the version of application bundle or executable file.
@ -280,6 +282,8 @@ class Browser : public WindowListObserver {
int badge_count_ = 0;
util::Promise* ready_promise_ = nullptr;
#if defined(OS_MACOSX)
base::DictionaryValue about_panel_options_;
#endif