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) { |