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

Unified Diff: mojo/public/js/connector.js

Issue 2405093003: [WIP] Mojo native bindings interface.
Patch Set: cleanup 2 Created 4 years, 2 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: mojo/public/js/connector.js
diff --git a/mojo/public/js/connector.js b/mojo/public/js/connector.js
index 674f36b3210d3fced0abd04c1163fcfac49933b9..8725963e0437d58e24a2eaa285fe9309240de595 100644
--- a/mojo/public/js/connector.js
+++ b/mojo/public/js/connector.js
@@ -6,12 +6,12 @@ define("mojo/public/js/connector", [
"mojo/public/js/buffer",
"mojo/public/js/codec",
"mojo/public/js/core",
- "mojo/public/js/support",
-], function(buffer, codec, core, support) {
+], function(buffer, codec, core) {
function Connector(handle) {
- if (!core.isHandle(handle))
+ if (!(handle instanceof MojoHandle))
throw new Error("Connector: not a handle " + handle);
+
this.handle_ = handle;
this.dropWrites_ = false;
this.error_ = false;
@@ -20,19 +20,19 @@ define("mojo/public/js/connector", [
this.errorHandler_ = null;
if (handle) {
- this.readWatcher_ = support.watch(handle,
- core.HANDLE_SIGNAL_READABLE,
- this.readMore_.bind(this));
+ this.readWatcher_ = core.watch(handle,
+ core.HANDLE_SIGNAL_READABLE,
+ this.readMore_.bind(this));
}
}
Connector.prototype.close = function() {
if (this.readWatcher_) {
- support.cancelWatch(this.readWatcher_);
+ this.readWatcher_.cancel();
this.readWatcher_ = null;
}
if (this.handle_ != null) {
- core.close(this.handle_);
+ this.handle_.close();
this.handle_ = null;
}
};
@@ -45,7 +45,7 @@ define("mojo/public/js/connector", [
return true;
var result = core.writeMessage(this.handle_,
- new Uint8Array(message.buffer.arrayBuffer),
+ message.buffer.arrayBuffer,
message.handles,
core.WRITE_MESSAGE_FLAG_NONE);
switch (result) {

Powered by Google App Engine
This is Rietveld 408576698