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

Side by Side Diff: mojo/public/js/connector.js

Issue 703273002: Update mojo sdk to rev 04a510fb37db10642e156957f9b2c11c2f6442ac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix content/child -> mojo/common linking Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « mojo/public/js/connection.js ('k') | mojo/public/js/constants.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 define("mojo/public/js/bindings/connector", [ 5 define("mojo/public/js/connector", [
6 "mojo/public/js/bindings/buffer", 6 "mojo/public/js/buffer",
7 "mojo/public/js/bindings/codec", 7 "mojo/public/js/codec",
8 "mojo/public/js/bindings/core", 8 "mojo/public/js/core",
9 "mojo/public/js/bindings/support", 9 "mojo/public/js/support",
10 ], function(buffer, codec, core, support) { 10 ], function(buffer, codec, core, support) {
11 11
12 function Connector(handle) { 12 function Connector(handle) {
13 this.handle_ = handle; 13 this.handle_ = handle;
14 this.dropWrites_ = false; 14 this.dropWrites_ = false;
15 this.error_ = false; 15 this.error_ = false;
16 this.incomingReceiver_ = null; 16 this.incomingReceiver_ = null;
17 this.readWaitCookie_ = null; 17 this.readWaitCookie_ = null;
18 this.errorHandler_ = null; 18 this.errorHandler_ = null;
19 19
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 Connector.prototype.waitToReadMore_ = function() { 79 Connector.prototype.waitToReadMore_ = function() {
80 this.readWaitCookie_ = support.asyncWait(this.handle_, 80 this.readWaitCookie_ = support.asyncWait(this.handle_,
81 core.HANDLE_SIGNAL_READABLE, 81 core.HANDLE_SIGNAL_READABLE,
82 this.readMore_.bind(this)); 82 this.readMore_.bind(this));
83 }; 83 };
84 84
85 Connector.prototype.readMore_ = function(result) { 85 Connector.prototype.readMore_ = function(result) {
86 for (;;) { 86 for (;;) {
87 var read = core.readMessage(this.handle_, 87 var read = core.readMessage(this.handle_,
88 core.READ_MESSAGE_FLAG_NONE); 88 core.READ_MESSAGE_FLAG_NONE);
89 if (this.handle_ == null) // The connector has been closed.
90 return;
89 if (read.result == core.RESULT_SHOULD_WAIT) { 91 if (read.result == core.RESULT_SHOULD_WAIT) {
90 this.waitToReadMore_(); 92 this.waitToReadMore_();
91 return; 93 return;
92 } 94 }
93 if (read.result != core.RESULT_OK) { 95 if (read.result != core.RESULT_OK) {
94 this.error_ = true; 96 this.error_ = true;
95 if (this.errorHandler_) 97 if (this.errorHandler_)
96 this.errorHandler_.onError(read.result); 98 this.errorHandler_.onError(read.result);
97 return; 99 return;
98 } 100 }
(...skipping 19 matching lines...) Expand all
118 120
119 TestConnector.prototype.deliverMessage = function() { 121 TestConnector.prototype.deliverMessage = function() {
120 this.readMore_(core.RESULT_OK); 122 this.readMore_(core.RESULT_OK);
121 } 123 }
122 124
123 var exports = {}; 125 var exports = {};
124 exports.Connector = Connector; 126 exports.Connector = Connector;
125 exports.TestConnector = TestConnector; 127 exports.TestConnector = TestConnector;
126 return exports; 128 return exports;
127 }); 129 });
OLDNEW
« no previous file with comments | « mojo/public/js/connection.js ('k') | mojo/public/js/constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698