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:
Cheng Zhao 2014-01-27 15:14:11 +08:00
parent 5250871e69
commit d63de1ae15
8 changed files with 32 additions and 0 deletions

View file

@ -92,6 +92,7 @@ void Window::OnRendererCrashed() {
void Window::OnCapturePageDone(const RefCountedV8Function& callback,
const std::vector<unsigned char>& data) {
v8::Locker locker(node_isolate);
v8::HandleScope handle_scope(node_isolate);
v8::Local<v8::Value> buffer = node::Buffer::New(