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

Side by Side Diff: mojo/services/public/js/service_provider.js

Issue 858103002: Remove [Client=] annotation from ServiceProvider (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: rebase for trybots (no code changes from ps2) Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « mojo/services/public/js/application.js ('k') | mojo/services/public/js/shell.js » ('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/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, spMojom, 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 = spMojom.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))
23 throw new Error("service must be a ServiceProvider proxy");
24 this.proxy = service; 22 this.proxy = service;
25 ProxyBindings(this.proxy).setLocalDelegate(this);
26 this.providers_ = new Map(); // serviceName => see provideService() below 23 this.providers_ = new Map(); // serviceName => see provideService() below
27 this.pendingRequests_ = new Map(); // serviceName => serviceHandle 24 this.pendingRequests_ = new Map(); // serviceName => serviceHandle
28 } 25 }
29 26
30 // Incoming requests 27 // Incoming requests
31 connectToService(serviceName, serviceHandle) { 28 connectToService(serviceName, serviceHandle) {
32 if (!this.providers_) // We're closed. 29 if (!this.providers_) // We're closed.
33 return; 30 return;
34 31
35 var provider = this.providers_.get(serviceName); 32 var provider = this.providers_.get(serviceName);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 close() { 77 close() {
81 this.providers_ = null; 78 this.providers_ = null;
82 this.pendingRequests_ = null; 79 this.pendingRequests_ = null;
83 } 80 }
84 } 81 }
85 82
86 var exports = {}; 83 var exports = {};
87 exports.ServiceProvider = ServiceProvider; 84 exports.ServiceProvider = ServiceProvider;
88 return exports; 85 return exports;
89 }); 86 });
OLDNEW
« no previous file with comments | « mojo/services/public/js/application.js ('k') | mojo/services/public/js/shell.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698