fix: add microtask runner and fix promise test (#15071)
* fix: Promise resolution and unit test * Update to use microtask runner * Address review
This commit is contained in:
parent
89bf71e580
commit
0c711f690e
13 changed files with 90 additions and 18 deletions
|
@ -5,6 +5,8 @@
|
|||
#ifndef ATOM_BROWSER_JAVASCRIPT_ENVIRONMENT_H_
|
||||
#define ATOM_BROWSER_JAVASCRIPT_ENVIRONMENT_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "gin/public/isolate_holder.h"
|
||||
#include "uv.h" // NOLINT(build/include)
|
||||
|
@ -16,12 +18,14 @@ class MultiIsolatePlatform;
|
|||
|
||||
namespace atom {
|
||||
|
||||
class MicrotasksRunner;
|
||||
// Manage the V8 isolate and context automatically.
|
||||
class JavascriptEnvironment {
|
||||
public:
|
||||
explicit JavascriptEnvironment(uv_loop_t* event_loop);
|
||||
~JavascriptEnvironment();
|
||||
|
||||
void OnMessageLoopCreated();
|
||||
void OnMessageLoopDestroying();
|
||||
|
||||
node::MultiIsolatePlatform* platform() const { return platform_; }
|
||||
|
@ -43,6 +47,8 @@ class JavascriptEnvironment {
|
|||
v8::Global<v8::Context> context_;
|
||||
v8::Context::Scope context_scope_;
|
||||
|
||||
std::unique_ptr<MicrotasksRunner> microtasks_runner_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(JavascriptEnvironment);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue