GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage-daily/nodes/benchmark/out/../src/stream_pipe.h Lines: 5 5 100.0 %
Date: 2019-09-15 22:29:17 Branches: 2 4 50.0 %

Line Branch Exec Source
1
#ifndef SRC_STREAM_PIPE_H_
2
#define SRC_STREAM_PIPE_H_
3
4
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
6
#include "stream_base.h"
7
8
namespace node {
9
10
class StreamPipe : public AsyncWrap {
11
 public:
12
  StreamPipe(StreamBase* source, StreamBase* sink, v8::Local<v8::Object> obj);
13
  ~StreamPipe() override;
14
15
  void Unpipe();
16
17
  static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
18
  static void Start(const v8::FunctionCallbackInfo<v8::Value>& args);
19
  static void Unpipe(const v8::FunctionCallbackInfo<v8::Value>& args);
20
21
2
  SET_NO_MEMORY_INFO()
22
2
  SET_MEMORY_INFO_NAME(StreamPipe)
23
2
  SET_SELF_SIZE(StreamPipe)
24
25
 private:
26
  inline StreamBase* source();
27
  inline StreamBase* sink();
28
29
  inline void ShutdownWritable();
30
31
  bool is_reading_ = false;
32
  bool is_writing_ = false;
33
  bool is_eof_ = false;
34
  bool is_closed_ = true;
35
  bool sink_destroyed_ = false;
36
  bool source_destroyed_ = false;
37
38
  // Set a default value so that when we’re coming from Start(), we know
39
  // that we don’t want to read just yet.
40
  // This will likely need to be changed when supporting streams without
41
  // `OnStreamWantsWrite()` support.
42
  size_t wanted_data_ = 0;
43
44
  void ProcessData(size_t nread, AllocatedBuffer&& buf);
45
46
30
  class ReadableListener : public StreamListener {
47
   public:
48
    uv_buf_t OnStreamAlloc(size_t suggested_size) override;
49
    void OnStreamRead(ssize_t nread, const uv_buf_t& buf) override;
50
    void OnStreamDestroy() override;
51
  };
52
53
30
  class WritableListener : public StreamListener {
54
   public:
55
    uv_buf_t OnStreamAlloc(size_t suggested_size) override;
56
    void OnStreamRead(ssize_t nread, const uv_buf_t& buf) override;
57
    void OnStreamAfterWrite(WriteWrap* w, int status) override;
58
    void OnStreamAfterShutdown(ShutdownWrap* w, int status) override;
59
    void OnStreamWantsWrite(size_t suggested_size) override;
60
    void OnStreamDestroy() override;
61
  };
62
63
  ReadableListener readable_listener_;
64
  WritableListener writable_listener_;
65
};
66
67
}  // namespace node
68
69
#endif
70
71
#endif  // SRC_STREAM_PIPE_H_