OLD | NEW |
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 (function() { | 5 (function() { |
6 var internal = mojo.internal; | 6 var internal = mojo.internal; |
7 | 7 |
8 /** | 8 /** |
9 * The state of |endpoint|. If both the endpoint and its peer have been | 9 * The state of |endpoint|. If both the endpoint and its peer have been |
10 * closed, removes it from |endpoints_|. | 10 * closed, removes it from |endpoints_|. |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 }; | 224 }; |
225 | 225 |
226 Router.prototype.close = function() { | 226 Router.prototype.close = function() { |
227 this.connector_.close(); | 227 this.connector_.close(); |
228 // Closing the message pipe won't trigger connection error handler. | 228 // Closing the message pipe won't trigger connection error handler. |
229 // Explicitly call onPipeConnectionError() so that associated endpoints | 229 // Explicitly call onPipeConnectionError() so that associated endpoints |
230 // will get notified. | 230 // will get notified. |
231 this.onPipeConnectionError(); | 231 this.onPipeConnectionError(); |
232 }; | 232 }; |
233 | 233 |
234 Router.prototype.waitForNextMessageForTesting = function() { | |
235 this.connector_.waitForNextMessageForTesting(); | |
236 }; | |
237 | |
238 Router.prototype.onPeerAssociatedEndpointClosed = function(interfaceId, | 234 Router.prototype.onPeerAssociatedEndpointClosed = function(interfaceId, |
239 reason) { | 235 reason) { |
240 check(!internal.isMasterInterfaceId(interfaceId) || reason); | 236 check(!internal.isMasterInterfaceId(interfaceId) || reason); |
241 | 237 |
242 var endpoint = this.endpoints_.get(interfaceId); | 238 var endpoint = this.endpoints_.get(interfaceId); |
243 if (!endpoint) { | 239 if (!endpoint) { |
244 endpoint = new InterfaceEndpoint(this, interfaceId); | 240 endpoint = new InterfaceEndpoint(this, interfaceId); |
245 this.endpoints_.set(interfaceId, endpoint); | 241 this.endpoints_.set(interfaceId, endpoint); |
246 } | 242 } |
247 | 243 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 } else { | 301 } else { |
306 endpoint.peerClosed = true; | 302 endpoint.peerClosed = true; |
307 } | 303 } |
308 if (endpoint.closed && endpoint.peerClosed) { | 304 if (endpoint.closed && endpoint.peerClosed) { |
309 this.endpoints_.delete(endpoint.id); | 305 this.endpoints_.delete(endpoint.id); |
310 } | 306 } |
311 }; | 307 }; |
312 | 308 |
313 internal.Router = Router; | 309 internal.Router = Router; |
314 })(); | 310 })(); |
OLD | NEW |