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

Unified Diff: extensions/renderer/resources/messaging.js

Issue 2300453002: [Extensions] Begin making Extension port initialization asynchronous (Closed)
Patch Set: Nasko's Created 4 years, 3 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
« no previous file with comments | « extensions/renderer/messaging_bindings.cc ('k') | extensions/renderer/resources/runtime_custom_bindings.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/resources/messaging.js
diff --git a/extensions/renderer/resources/messaging.js b/extensions/renderer/resources/messaging.js
index 38ad9447c302b23f607108ad3fa049d7e0236770..f4c97e9e9ef5b5941af8964fd950d0495c0d010f 100644
--- a/extensions/renderer/resources/messaging.js
+++ b/extensions/renderer/resources/messaging.js
@@ -26,10 +26,6 @@
// Map of port IDs to port object.
var ports = {__proto__: null};
- // Change even to odd and vice versa, to get the other side of a given
- // channel.
- function getOppositePortId(portId) { return portId ^ 1; }
-
// Port object. Represents a connection to another script context through
// which messages can be passed.
function PortImpl(portId, opt_name) {
@@ -104,13 +100,6 @@
delete ports[this.portId_];
};
- // Returns true if the specified port id is in this context. This is used by
- // the C++ to avoid creating the javascript message for all the contexts that
- // don't care about a particular message.
- function hasPort(portId) {
- return $Object.hasOwnProperty(ports, portId);
- };
-
// Hidden port creation function. We don't want to expose an API that lets
// people add arbitrary port IDs to the port list.
function createPort(portId, opt_name) {
@@ -249,9 +238,6 @@
// the right extension.
logging.CHECK(targetExtensionId == extensionId);
- if (ports[getOppositePortId(portId)])
- return false; // this channel was opened by us, so ignore it
-
// Determine whether this is coming from another extension, so we can use
// the right event.
var isExternal = sourceExtensionId != extensionId;
@@ -434,7 +420,6 @@ exports.$set('sendMessageImpl', sendMessageImpl);
exports.$set('sendMessageUpdateArguments', sendMessageUpdateArguments);
// For C++ code to call.
-exports.$set('hasPort', hasPort);
exports.$set('dispatchOnConnect', dispatchOnConnect);
exports.$set('dispatchOnDisconnect', dispatchOnDisconnect);
exports.$set('dispatchOnMessage', dispatchOnMessage);
« no previous file with comments | « extensions/renderer/messaging_bindings.cc ('k') | extensions/renderer/resources/runtime_custom_bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698