diff options
Diffstat (limited to 'src/node/ext/call.h')
-rw-r--r-- | src/node/ext/call.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/node/ext/call.h b/src/node/ext/call.h index cffff00fce..31c6566d14 100644 --- a/src/node/ext/call.h +++ b/src/node/ext/call.h @@ -51,12 +51,20 @@ namespace node { using std::unique_ptr; using std::shared_ptr; +typedef Nan::Persistent<v8::Value, Nan::CopyablePersistentTraits<v8::Value>> PersistentValue; + v8::Local<v8::Value> nanErrorWithCode(const char *msg, grpc_call_error code); v8::Local<v8::Value> ParseMetadata(const grpc_metadata_array *metadata_array); +struct Resources { + std::vector<unique_ptr<Nan::Utf8String> > strings; + std::vector<unique_ptr<PersistentValue> > handles; +}; + bool CreateMetadataArray(v8::Local<v8::Object> metadata, - grpc_metadata_array *array); + grpc_metadata_array *array, + shared_ptr<Resources> resources); /* Wrapper class for grpc_call structs. */ class Call : public Nan::ObjectWrap { @@ -98,7 +106,8 @@ class Call : public Nan::ObjectWrap { class Op { public: virtual v8::Local<v8::Value> GetNodeValue() const = 0; - virtual bool ParseOp(v8::Local<v8::Value> value, grpc_op *out) = 0; + virtual bool ParseOp(v8::Local<v8::Value> value, grpc_op *out, + shared_ptr<Resources> resources) = 0; virtual ~Op(); v8::Local<v8::Value> GetOpType() const; virtual bool IsFinalOp() = 0; @@ -109,10 +118,12 @@ class Op { typedef std::vector<unique_ptr<Op>> OpVec; struct tag { - tag(Nan::Callback *callback, OpVec *ops, Call *call); + tag(Nan::Callback *callback, OpVec *ops, + shared_ptr<Resources> resources, Call *call); ~tag(); Nan::Callback *callback; OpVec *ops; + shared_ptr<Resources> resources; Call *call; }; |