Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4856)

Unified Diff: chrome/renderer/extensions/miscellaneous_bindings.cc

Issue 15855010: Make ExtensionMsg_MessageInvoke run a module system function rather than a (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: go Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}
}

Powered by Google App Engine
This is Rietveld 408576698