What is the correct way to use v8::Locker, and why must I use it?
问题 I'm trying to embed v8 in an Android application using NDK. I have a JNI module that looks something like this (JNI mapping code not shown): #include <jni.h> #include <android/log.h> #include <v8.h> using namespace v8; static jlong getMagicNumber() { HandleScope handle_scope; Persistent<Context> context = Context::New(); Context::Scope context_scope(context); Handle<String> source = String::New("40 + 2"); Handle<Script> script = Script::Compile(source); Handle<Value> result = script->Run();