fix: intercept the isolate_holder's new isolate and register it with the node platform before initialization
Chromium Change: 1015020
This commit is contained in:
parent
bacc36dde1
commit
7589c56cea
9 changed files with 139 additions and 129 deletions
|
@ -11,6 +11,7 @@
|
|||
namespace node {
|
||||
class Environment;
|
||||
class MultiIsolatePlatform;
|
||||
class IsolateData;
|
||||
} // namespace node
|
||||
|
||||
namespace atom {
|
||||
|
@ -29,6 +30,7 @@ class JavascriptEnvironment {
|
|||
v8::Local<v8::Context> context() const {
|
||||
return v8::Local<v8::Context>::New(isolate_, context_);
|
||||
}
|
||||
void set_isolate_data(node::IsolateData* data) { isolate_data_ = data; }
|
||||
|
||||
private:
|
||||
bool Initialize();
|
||||
|
@ -44,6 +46,7 @@ class JavascriptEnvironment {
|
|||
v8::HandleScope handle_scope_;
|
||||
v8::UniquePersistent<v8::Context> context_;
|
||||
v8::Context::Scope context_scope_;
|
||||
node::IsolateData* isolate_data_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(JavascriptEnvironment);
|
||||
};
|
||||
|
@ -60,6 +63,18 @@ class NodeEnvironment {
|
|||
DISALLOW_COPY_AND_ASSIGN(NodeEnvironment);
|
||||
};
|
||||
|
||||
class AtomIsolateAllocator : public gin::IsolateAllocater {
|
||||
public:
|
||||
explicit AtomIsolateAllocator(JavascriptEnvironment* env);
|
||||
|
||||
v8::Isolate* Allocate() override;
|
||||
|
||||
private:
|
||||
JavascriptEnvironment* env_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomIsolateAllocator);
|
||||
};
|
||||
|
||||
} // namespace atom
|
||||
|
||||
#endif // ATOM_BROWSER_JAVASCRIPT_ENVIRONMENT_H_
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue