update libcc for using custom platform with gin
This commit is contained in:
parent
769fbd0d3b
commit
b9ace16959
3 changed files with 15 additions and 4 deletions
|
@ -145,7 +145,7 @@ void AtomBrowserMainParts::PostEarlyInitialization() {
|
||||||
|
|
||||||
// Enable support for v8 inspector
|
// Enable support for v8 inspector
|
||||||
node_debugger_.reset(new NodeDebugger(env));
|
node_debugger_.reset(new NodeDebugger(env));
|
||||||
node_debugger_->Start();
|
node_debugger_->Start(js_env_->platform());
|
||||||
|
|
||||||
// Add Electron extended APIs.
|
// Add Electron extended APIs.
|
||||||
atom_bindings_->BindTo(js_env_->isolate(), env->process_object());
|
atom_bindings_->BindTo(js_env_->isolate(), env->process_object());
|
||||||
|
|
|
@ -26,7 +26,8 @@ JavascriptEnvironment::JavascriptEnvironment()
|
||||||
locker_(isolate_),
|
locker_(isolate_),
|
||||||
handle_scope_(isolate_),
|
handle_scope_(isolate_),
|
||||||
context_(isolate_, v8::Context::New(isolate_)),
|
context_(isolate_, v8::Context::New(isolate_)),
|
||||||
context_scope_(v8::Local<v8::Context>::New(isolate_, context_)) {}
|
context_scope_(v8::Local<v8::Context>::New(isolate_, context_)) {
|
||||||
|
}
|
||||||
|
|
||||||
void JavascriptEnvironment::OnMessageLoopCreated() {
|
void JavascriptEnvironment::OnMessageLoopCreated() {
|
||||||
isolate_holder_.AddRunMicrotasksObserver();
|
isolate_holder_.AddRunMicrotasksObserver();
|
||||||
|
@ -44,10 +45,17 @@ bool JavascriptEnvironment::Initialize() {
|
||||||
if (!js_flags.empty())
|
if (!js_flags.empty())
|
||||||
v8::V8::SetFlagsFromString(js_flags.c_str(), js_flags.size());
|
v8::V8::SetFlagsFromString(js_flags.c_str(), js_flags.size());
|
||||||
|
|
||||||
|
// The V8Platform of gin relies on Chromium's task schedule, which has not
|
||||||
|
// been started at this point, so we have to rely on Node's V8Platform.
|
||||||
|
platform_ = node::CreatePlatform(
|
||||||
|
base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0),
|
||||||
|
uv_default_loop(), nullptr);
|
||||||
|
v8::V8::InitializePlatform(platform_);
|
||||||
|
|
||||||
gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode,
|
gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode,
|
||||||
gin::IsolateHolder::kStableV8Extras,
|
gin::IsolateHolder::kStableV8Extras,
|
||||||
gin::ArrayBufferAllocator::SharedInstance());
|
gin::ArrayBufferAllocator::SharedInstance(),
|
||||||
|
false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,9 @@ class JavascriptEnvironment {
|
||||||
private:
|
private:
|
||||||
bool Initialize();
|
bool Initialize();
|
||||||
|
|
||||||
|
// Leaked on exit.
|
||||||
|
node::NodePlatform* platform_;
|
||||||
|
|
||||||
bool initialized_;
|
bool initialized_;
|
||||||
gin::IsolateHolder isolate_holder_;
|
gin::IsolateHolder isolate_holder_;
|
||||||
v8::Isolate* isolate_;
|
v8::Isolate* isolate_;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue