| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * |
| 3 * Copyright 2015, Google Inc. |
| 4 * All rights reserved. |
| 3 * | 5 * |
| 4 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 7 * modification, are permitted provided that the following conditions are |
| 6 * met: | 8 * met: |
| 7 * | 9 * |
| 8 * * Redistributions of source code must retain the above copyright | 10 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 11 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 12 * * Redistributions in binary form must reproduce the above |
| 11 * copyright notice, this list of conditions and the following disclaimer | 13 * copyright notice, this list of conditions and the following disclaimer |
| 12 * in the documentation and/or other materials provided with the | 14 * in the documentation and/or other materials provided with the |
| 13 * distribution. | 15 * distribution. |
| 14 * * Neither the name of Google Inc. nor the names of its | 16 * * Neither the name of Google Inc. nor the names of its |
| 15 * contributors may be used to endorse or promote products derived from | 17 * contributors may be used to endorse or promote products derived from |
| 16 * this software without specific prior written permission. | 18 * this software without specific prior written permission. |
| 17 * | 19 * |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 * |
| 29 */ | 32 */ |
| 30 | 33 |
| 31 #ifndef CompositedSelectionBound_h | 34 #ifndef NET_GRPC_NODE_SERVER_H_ |
| 32 #define CompositedSelectionBound_h | 35 #define NET_GRPC_NODE_SERVER_H_ |
| 33 | 36 |
| 34 #include "platform/geometry/FloatPoint.h" | 37 #include <node.h> |
| 35 #include "platform/graphics/GraphicsLayer.h" | 38 #include <nan.h> |
| 36 #include "wtf/Allocator.h" | 39 #include "grpc/grpc.h" |
| 37 | 40 |
| 38 namespace blink { | 41 namespace grpc { |
| 42 namespace node { |
| 39 | 43 |
| 40 struct CompositedSelectionBound { | 44 /* Wraps grpc_server as a JavaScript object. Provides a constructor |
| 41 STACK_ALLOCATED(); | 45 and wrapper methods for grpc_server_create, grpc_server_request_call, |
| 42 CompositedSelectionBound() | 46 grpc_server_add_http2_port, and grpc_server_start. */ |
| 43 : layer(nullptr) | 47 class Server : public Nan::ObjectWrap { |
| 44 , isTextDirectionRTL(false) | 48 public: |
| 45 { | 49 /* Initializes the Server class and exposes the constructor and |
| 46 } | 50 wrapper methods to JavaScript */ |
| 51 static void Init(v8::Local<v8::Object> exports); |
| 52 /* Tests whether the given value was constructed by this class's |
| 53 JavaScript constructor */ |
| 54 static bool HasInstance(v8::Local<v8::Value> val); |
| 47 | 55 |
| 48 // The structure describes the position of a caret in space of the GraphicsL
ayer the caret resides in. | 56 private: |
| 49 // Where edgeTopInLayer is the top point of the caret, usually on the ascend
line of the line box, | 57 explicit Server(grpc_server *server); |
| 50 // and edgeBottomInLayer it the bottom point, on the baseline of the line bo
x. | 58 ~Server(); |
| 51 GraphicsLayer* layer; | |
| 52 FloatPoint edgeTopInLayer; | |
| 53 FloatPoint edgeBottomInLayer; | |
| 54 | 59 |
| 55 bool isTextDirectionRTL; | 60 // Prevent copying |
| 61 Server(const Server &); |
| 62 Server &operator=(const Server &); |
| 63 |
| 64 void ShutdownServer(); |
| 65 |
| 66 static NAN_METHOD(New); |
| 67 static NAN_METHOD(RequestCall); |
| 68 static NAN_METHOD(AddHttp2Port); |
| 69 static NAN_METHOD(Start); |
| 70 static NAN_METHOD(TryShutdown); |
| 71 static NAN_METHOD(ForceShutdown); |
| 72 static Nan::Callback *constructor; |
| 73 static Nan::Persistent<v8::FunctionTemplate> fun_tpl; |
| 74 |
| 75 grpc_server *wrapped_server; |
| 76 grpc_completion_queue *shutdown_queue; |
| 56 }; | 77 }; |
| 57 | 78 |
| 58 } // namespace blink | 79 } // namespace node |
| 80 } // namespace grpc |
| 59 | 81 |
| 60 #endif | 82 #endif // NET_GRPC_NODE_SERVER_H_ |
| OLD | NEW |