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
|
@ -35,6 +35,7 @@ static const char* kEarlyUseProtocolError = "This method can only be used"
|
|||
|
||||
// Emit an event for the protocol module.
|
||||
void EmitEventInUI(const std::string& event, const std::string& parameter) {
|
||||
v8::Locker locker(node_isolate);
|
||||
v8::HandleScope handle_scope(node_isolate);
|
||||
|
||||
v8::Handle<v8::Value> argv[] = {
|
||||
|
@ -72,6 +73,7 @@ class CustomProtocolRequestJob : public AdapterRequestJob {
|
|||
virtual void GetJobTypeInUI() OVERRIDE {
|
||||
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
||||
|
||||
v8::Locker locker(node_isolate);
|
||||
v8::HandleScope handle_scope(node_isolate);
|
||||
|
||||
// Call the JS handler.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue