Lines Matching refs:pipe
109 StreamPipe* pipe = ContainerOf(&StreamPipe::readable_listener_, this);
110 size_t size = std::min(suggested_size, pipe->wanted_data_);
112 return pipe->env()->allocate_managed_buffer(size);
117 StreamPipe* pipe = ContainerOf(&StreamPipe::readable_listener_, this);
118 std::unique_ptr<BackingStore> bs = pipe->env()->release_managed_buffer(buf_);
122 pipe->is_eof_ = true;
125 StreamBase* sink = pipe->sink();
131 if (pipe->pending_writes_ == 0) {
133 pipe->Unpipe();
138 pipe->ProcessData(nread, std::move(bs));
159 StreamPipe* pipe = ContainerOf(&StreamPipe::writable_listener_, this);
160 pipe->pending_writes_--;
161 if (pipe->is_closed_) {
162 if (pipe->pending_writes_ == 0) {
163 Environment* env = pipe->env();
166 if (pipe->MakeCallback(env->oncomplete_string(), 0, nullptr).IsEmpty())
173 if (pipe->is_eof_) {
174 HandleScope handle_scope(pipe->env()->isolate());
175 InternalCallbackScope callback_scope(pipe,
177 pipe->sink()->Shutdown();
178 pipe->Unpipe();
185 pipe->Unpipe();
190 if (!pipe->uses_wants_write_) {
197 StreamPipe* pipe = ContainerOf(&StreamPipe::writable_listener_, this);
200 pipe->Unpipe();
205 StreamPipe* pipe = ContainerOf(&StreamPipe::readable_listener_, this);
206 pipe->source_destroyed_ = true;
207 if (!pipe->is_eof_) {
213 StreamPipe* pipe = ContainerOf(&StreamPipe::writable_listener_, this);
214 pipe->sink_destroyed_ = true;
215 pipe->is_eof_ = true;
216 pipe->pending_writes_ = 0;
217 pipe->Unpipe();
221 StreamPipe* pipe = ContainerOf(&StreamPipe::writable_listener_, this);
222 pipe->wanted_data_ = suggested_size;
223 if (pipe->is_reading_ || pipe->is_closed_)
225 HandleScope handle_scope(pipe->env()->isolate());
226 InternalCallbackScope callback_scope(pipe,
228 pipe->is_reading_ = true;
229 pipe->source()->ReadStart();
286 StreamPipe* pipe;
287 ASSIGN_OR_RETURN_UNWRAP(&pipe, args.Holder());
288 pipe->is_closed_ = false;
289 pipe->writable_listener_.OnStreamWantsWrite(65536);
293 StreamPipe* pipe;
294 ASSIGN_OR_RETURN_UNWRAP(&pipe, args.Holder());
295 pipe->Unpipe();
299 StreamPipe* pipe;
300 ASSIGN_OR_RETURN_UNWRAP(&pipe, args.Holder());
301 args.GetReturnValue().Set(pipe->is_closed_);
305 StreamPipe* pipe;
306 ASSIGN_OR_RETURN_UNWRAP(&pipe, args.Holder());
307 args.GetReturnValue().Set(pipe->pending_writes_);
320 Local<FunctionTemplate> pipe = NewFunctionTemplate(isolate, StreamPipe::New);
321 SetProtoMethod(isolate, pipe, "unpipe", StreamPipe::Unpipe);
322 SetProtoMethod(isolate, pipe, "start", StreamPipe::Start);
323 SetProtoMethod(isolate, pipe, "isClosed", StreamPipe::IsClosed);
324 SetProtoMethod(isolate, pipe, "pendingWrites", StreamPipe::PendingWrites);
325 pipe->Inherit(AsyncWrap::GetConstructorTemplate(env));
326 pipe->InstanceTemplate()->SetInternalFieldCount(
328 SetConstructorFunction(context, target, "StreamPipe", pipe);