| 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 define("mojo/services/public/js/service_provider", [ | 5 define("mojo/services/public/js/service_provider", [ |
| 6 "mojo/public/js/bindings", | 6 "mojo/public/js/bindings", |
| 7 "mojo/public/interfaces/application/service_provider.mojom", | 7 "mojo/public/interfaces/application/service_provider.mojom", |
| 8 "mojo/public/js/connection", | 8 "mojo/public/js/connection", |
| 9 ], function(bindings, serviceProviderMojom, connection) { | 9 ], function(bindings, spMojom, connection) { |
| 10 | 10 |
| 11 const ProxyBindings = bindings.ProxyBindings; | 11 const ProxyBindings = bindings.ProxyBindings; |
| 12 const StubBindings = bindings.StubBindings; | 12 const StubBindings = bindings.StubBindings; |
| 13 const ServiceProviderInterface = serviceProviderMojom.ServiceProvider; | 13 const ServiceProviderInterface = spMojom.ServiceProvider; |
| 14 | 14 |
| 15 function checkServiceProvider(sp) { | 15 function checkServiceProvider(sp) { |
| 16 if (!sp.providers_) | 16 if (!sp.providers_) |
| 17 throw new Error("Service was closed"); | 17 throw new Error("Service was closed"); |
| 18 } | 18 } |
| 19 | 19 |
| 20 class ServiceProvider { | 20 class ServiceProvider { |
| 21 constructor(service) { | 21 constructor(service) { |
| 22 if (!(service instanceof ServiceProviderInterface.proxyClass)) | 22 if (!(service instanceof ServiceProviderInterface.proxyClass)) |
| 23 throw new Error("service must be a ServiceProvider proxy"); | 23 throw new Error("service must be a ServiceProvider proxy"); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 close() { | 80 close() { |
| 81 this.providers_ = null; | 81 this.providers_ = null; |
| 82 this.pendingRequests_ = null; | 82 this.pendingRequests_ = null; |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 | 85 |
| 86 var exports = {}; | 86 var exports = {}; |
| 87 exports.ServiceProvider = ServiceProvider; | 87 exports.ServiceProvider = ServiceProvider; |
| 88 return exports; | 88 return exports; |
| 89 }); | 89 }); |
| OLD | NEW |