Chromium Code Reviews| Index: chrome/renderer/extensions/miscellaneous_bindings.cc |
| diff --git a/chrome/renderer/extensions/miscellaneous_bindings.cc b/chrome/renderer/extensions/miscellaneous_bindings.cc |
| index d7e591dc1fbcb940a5e4595bf2c59025db333ed4..5d8b733821ef17a994386106c9cabf01c2409364 100644 |
| --- a/chrome/renderer/extensions/miscellaneous_bindings.cc |
| +++ b/chrome/renderer/extensions/miscellaneous_bindings.cc |
| @@ -134,11 +134,9 @@ class ExtensionImpl : public extensions::ChromeV8Extension { |
| // Send via the RenderThread because the RenderView might be closing. |
| bool notify_browser = args[1]->BooleanValue(); |
| - if (notify_browser) { |
| + if (notify_browser) |
| content::RenderThread::Get()->Send( |
| new ExtensionHostMsg_CloseChannel(port_id, std::string())); |
| - } |
| - |
| ClearPortData(port_id); |
| return v8::Undefined(); |
| @@ -260,27 +258,18 @@ void MiscellaneousBindings::DispatchOnConnect( |
| v8::String::New(source_url_spec.c_str(), source_url_spec.size()) |
| }; |
| - v8::Handle<v8::Value> retval; |
| - v8::TryCatch try_catch; |
| - if (!(*it)->CallChromeHiddenMethod("Port.dispatchOnConnect", |
| - arraysize(arguments), arguments, |
| - &retval)) { |
| - continue; |
| - } |
| - |
| - if (try_catch.HasCaught()) { |
| - LOG(ERROR) << "Exception caught when calling Port.dispatchOnConnect."; |
| - continue; |
| - } |
| + v8::Handle<v8::Value> retval = (*it)->module_system()->CallModuleMethod( |
|
koz (OOO until 15th September)
2013/05/31 04:28:44
No more need for v8::TryCatch?
not at google - send to devlin
2013/05/31 22:47:07
Yeah CallModuleMethod handles it. I figure it's si
|
| + "miscellaneous_bindings", |
| + "dispatchOnConnect", |
| + arraysize(arguments), arguments); |
| if (retval.IsEmpty()) { |
| - LOG(ERROR) << "Empty return value from Port.dispatchOnConnect."; |
| + LOG(ERROR) << "Empty return value from dispatchOnConnect."; |
| continue; |
| } |
| CHECK(retval->IsBoolean()); |
| - if (retval->BooleanValue()) |
| - port_created = true; |
| + port_created |= retval->BooleanValue(); |
| } |
| // If we didn't create a port, notify the other end of the channel (treat it |
| @@ -313,17 +302,10 @@ void MiscellaneousBindings::DeliverMessage( |
| // Check to see whether the context has this port before bothering to create |
| // the message. |
| v8::Handle<v8::Value> port_id_handle = v8::Integer::New(target_port_id); |
| - v8::Handle<v8::Value> has_port; |
| - v8::TryCatch try_catch; |
| - if (!(*it)->CallChromeHiddenMethod("Port.hasPort", 1, &port_id_handle, |
| - &has_port)) { |
| - continue; |
| - } |
| - |
| - if (try_catch.HasCaught()) { |
| - LOG(ERROR) << "Exception caught when calling Port.hasPort."; |
| - continue; |
| - } |
| + v8::Handle<v8::Value> has_port = (*it)->module_system()->CallModuleMethod( |
| + "miscellaneous_bindings", |
| + "hasPort", |
| + 1, &port_id_handle); |
| CHECK(!has_port.IsEmpty()); |
| if (!has_port->BooleanValue()) |
| @@ -344,10 +326,9 @@ void MiscellaneousBindings::DeliverMessage( |
| } |
| arguments.push_back(port_id_handle); |
| - CHECK((*it)->CallChromeHiddenMethod("Port.dispatchOnMessage", |
| - arguments.size(), |
| - &arguments[0], |
| - NULL)); |
| + (*it)->module_system()->CallModuleMethod("miscellaneous_bindings", |
| + "dispatchOnMessage", |
| + &arguments); |
| } |
| } |
| @@ -373,9 +354,9 @@ void MiscellaneousBindings::DispatchOnDisconnect( |
| } else { |
| arguments.push_back(v8::Null()); |
| } |
| - (*it)->CallChromeHiddenMethod("Port.dispatchOnDisconnect", |
| - arguments.size(), &arguments[0], |
| - NULL); |
| + (*it)->module_system()->CallModuleMethod("miscellaneous_bindings", |
| + "dispatchOnDisconnect", |
| + &arguments); |
| } |
| } |