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

Unified Diff: third_party/mojo_services/src/public/js/service_exchange.js

Issue 877993004: Revert "Update mojo sdk to rev 8d45c89c30b230843c5bd6dd0693a555750946c0" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/mojo_services/src/public/js/service_exchange.js
diff --git a/third_party/mojo_services/src/public/js/service_exchange.js b/third_party/mojo_services/src/public/js/service_exchange.js
deleted file mode 100644
index a424c12f72516dfa3a8efa9c0ce53d92f83fe17f..0000000000000000000000000000000000000000
--- a/third_party/mojo_services/src/public/js/service_exchange.js
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-define("mojo/services/public/js/service_exchange", [
- "mojo/public/js/bindings",
- "mojo/public/interfaces/application/service_provider.mojom",
- "mojo/public/js/connection",
-], function(bindings, spMojom, connection) {
-
- const ProxyBindings = bindings.ProxyBindings;
- const StubBindings = bindings.StubBindings;
- const ServiceProviderInterface = spMojom.ServiceProvider;
-
- function checkServiceExchange(exch) {
- if (!exch.providers_)
- throw new Error("Service was closed");
- }
-
- class ServiceExchange {
- constructor(servicesRequest, exposedServicesProxy) {
- this.proxy = exposedServicesProxy;
- this.providers_ = new Map(); // serviceName => see provideService() below
- this.pendingRequests_ = new Map(); // serviceName => serviceHandle
- if (servicesRequest)
- StubBindings(servicesRequest).delegate = this;
- }
-
- // Incoming requests
- connectToService(serviceName, serviceHandle) {
- if (!this.providers_) // We're closed.
- return;
-
- var provider = this.providers_.get(serviceName);
- if (!provider) {
- this.pendingRequests_.set(serviceName, serviceHandle);
- return;
- }
-
- var stub = connection.bindHandleToStub(serviceHandle, provider.service);
- StubBindings(stub).delegate = new provider.factory();
- provider.connections.push(StubBindings(stub).connection);
- }
-
- provideService(service, factory) {
- checkServiceExchange(this);
-
- var provider = {
- service: service, // A JS bindings interface object.
- factory: factory, // factory(clientProxy) => interface implemntation
- connections: [],
- };
- this.providers_.set(service.name, provider);
-
- if (this.pendingRequests_.has(service.name)) {
- this.connectToService(service.name, pendingRequests_.get(service.name));
- pendingRequests_.delete(service.name);
- }
- return this;
- }
-
- // Outgoing requests
- requestService(interfaceObject, clientImpl) {
- checkServiceExchange(this);
- if (!interfaceObject.name)
- throw new Error("Invalid service parameter");
- if (!clientImpl && interfaceObject.client)
- throw new Error("Client implementation must be provided");
-
- var serviceProxy;
- var serviceHandle = connection.bindProxy(
- function(sp) {serviceProxy = sp;}, interfaceObject);
- this.proxy.connectToService(interfaceObject.name, serviceHandle);
- return serviceProxy;
- };
-
- close() {
- this.providers_ = null;
- this.pendingRequests_ = null;
- }
- }
-
- var exports = {};
- exports.ServiceExchange = ServiceExchange;
- return exports;
-});
« no previous file with comments | « third_party/mojo_services/src/public/js/application.js ('k') | third_party/mojo_services/src/public/js/service_provider.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698