| Index: third_party/grpc/src/node/health_check/health.js
|
| diff --git a/third_party/WebKit/Source/platform/plugins/PluginListBuilder.h b/third_party/grpc/src/node/health_check/health.js
|
| similarity index 65%
|
| copy from third_party/WebKit/Source/platform/plugins/PluginListBuilder.h
|
| copy to third_party/grpc/src/node/health_check/health.js
|
| index ece23a9b2ddc3a2f60ab89cae320a597ccc3d757..6ab41571831b803f372fd7f32fd78a972d1ec2a3 100644
|
| --- a/third_party/WebKit/Source/platform/plugins/PluginListBuilder.h
|
| +++ b/third_party/grpc/src/node/health_check/health.js
|
| @@ -1,5 +1,7 @@
|
| /*
|
| - * Copyright (C) 2009 Google Inc. All rights reserved.
|
| + *
|
| + * Copyright 2015-2016, Google Inc.
|
| + * All rights reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| * modification, are permitted provided that the following conditions are
|
| @@ -26,32 +28,40 @@
|
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| + *
|
| */
|
|
|
| -#ifndef PluginListBuilder_h
|
| -#define PluginListBuilder_h
|
| +'use strict';
|
| +
|
| +var grpc = require('../');
|
|
|
| -#include "platform/plugins/PluginData.h"
|
| -#include "public/platform/WebPluginListBuilder.h"
|
| -#include "wtf/Allocator.h"
|
| -#include "wtf/Vector.h"
|
| +var _ = require('lodash');
|
|
|
| -namespace blink {
|
| +var health_proto = grpc.load(__dirname +
|
| + '/../../proto/grpc/health/v1/health.proto');
|
|
|
| -class PluginListBuilder final : public WebPluginListBuilder {
|
| - DISALLOW_NEW();
|
| -public:
|
| - PluginListBuilder(Vector<PluginInfo>* results) : m_results(results) { }
|
| +var HealthClient = health_proto.grpc.health.v1.Health;
|
|
|
| - // WebPluginListBuilder methods:
|
| - void addPlugin(const WebString& name, const WebString& description, const WebString& fileName) override;
|
| - void addMediaTypeToLastPlugin(const WebString& name, const WebString& description) override;
|
| - void addFileExtensionToLastMediaType(const WebString& extension) override;
|
| +function HealthImplementation(statusMap) {
|
| + this.statusMap = _.clone(statusMap);
|
| +}
|
|
|
| -private:
|
| - Vector<PluginInfo>* m_results;
|
| +HealthImplementation.prototype.setStatus = function(service, status) {
|
| + this.statusMap[service] = status;
|
| };
|
|
|
| -} // namespace blink
|
| +HealthImplementation.prototype.check = function(call, callback){
|
| + var service = call.request.service;
|
| + var status = _.get(this.statusMap, service, null);
|
| + if (status === null) {
|
| + callback({code:grpc.status.NOT_FOUND});
|
| + } else {
|
| + callback(null, {status: status});
|
| + }
|
| +};
|
|
|
| -#endif
|
| +module.exports = {
|
| + Client: HealthClient,
|
| + service: HealthClient.service,
|
| + Implementation: HealthImplementation
|
| +};
|
|
|