Wrap callbacks with v8::Locker.
In browser process, because of the use of v8::Locker in ProxyResolverV8, creating HandleScope requires entering locker first, so in browser process we should just use v8::Locker whenever we need to use V8 in a callback called from non-V8 places (like dialog's callback, work pushed to MessageLoop). But also notice that the renderer process doesn't use v8::Locker, so we have to be careful not to use it, otherwise blink would crash when creating HandleScope.
This commit is contained in:
parent
5250871e69
commit
d63de1ae15
8 changed files with 32 additions and 0 deletions
|
@ -19,7 +19,9 @@ namespace {
|
|||
|
||||
template<typename T>
|
||||
void CallV8Function(const RefCountedV8Function& callback, T arg) {
|
||||
v8::Locker locker(node_isolate);
|
||||
v8::HandleScope handle_scope(node_isolate);
|
||||
|
||||
v8::Handle<v8::Value> value = ToV8Value(arg);
|
||||
callback->NewHandle(node_isolate)->Call(
|
||||
v8::Context::GetCurrent()->Global(), 1, &value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue