我在隔离范围内调用“隔离->IdleNotification(100)”(通过“v8:隔离::作用域.”),并且在某个时候"V8::GetCurrentPlatform()->CallOnBackgroundThread(...)“在V8中调用"V8::GetCurrentPlatform()“返回NULL,整个事件就会死亡。知道为什么当前的平台可能是空的吗?或者更确切地说,应该做些什么来确保它不是呢?其他的一切似乎都很正常。
添加详细信息:我正在使用Visual 2013,并编译了源代码,其结果库与V8.Net包装器(在codeplex上)一起使用。在触发空闲通知调用之前,我运行以下代码:
v8::Locker __lockScope(engine->Isolate());
v8::Isolate::Scope __isolateScope(engine->Isolate());
v8::HandleScope __handleScope(Isolate::GetCurrent());我尝试了不同的组合,似乎只需要v8::Locker __lockScope,但平台仍然是空的;
v8::Platform* V8::GetCurrentPlatform() {
DCHECK(platform_); // <-- 'platform_' is NULL
return platform_;
}发布于 2014-12-19 09:25:05
之后不久就开始工作了,但忘了贴出答案。它是:谷歌改变了东西(惊喜!:/),现在你必须先初始化一个平台。我这样做了,一切又起作用了:
v8::V8::InitializePlatform(v8::platform::CreateDefaultPlatform());
// Sets the v8::Platform to use. This should be invoked before V8 is initialized.
v8::V8::InitializeICU();
// Initialize the ICU library bundled with V8. (if using the bundled ICU)
v8::V8::Initialize();
// Initialize V8.https://stackoverflow.com/questions/25674419
复制相似问题