mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add virtual destructors to ByteStream* (#20417)
This commit is contained in:
parent
dbc97c5c01
commit
3242a69ee4
@ -23,6 +23,8 @@ class ByteBufferStreamReader : public ByteStreamReader {
|
||||
explicit ByteBufferStreamReader(const uint8_t* bytes, size_t size)
|
||||
: bytes_(bytes), size_(size) {}
|
||||
|
||||
virtual ~ByteBufferStreamReader() = default;
|
||||
|
||||
// |ByteStreamReader|
|
||||
uint8_t ReadByte() override {
|
||||
if (location_ >= size_) {
|
||||
@ -69,6 +71,8 @@ class ByteBufferStreamWriter : public ByteStreamWriter {
|
||||
assert(buffer);
|
||||
}
|
||||
|
||||
virtual ~ByteBufferStreamWriter() = default;
|
||||
|
||||
// |ByteStreamWriter|
|
||||
void WriteByte(uint8_t byte) { bytes_->push_back(byte); }
|
||||
|
||||
|
||||
@ -12,6 +12,9 @@ namespace flutter {
|
||||
// An interface for a class that reads from a byte stream.
|
||||
class ByteStreamReader {
|
||||
public:
|
||||
explicit ByteStreamReader() = default;
|
||||
virtual ~ByteStreamReader() = default;
|
||||
|
||||
// Reads and returns the next byte from the stream.
|
||||
virtual uint8_t ReadByte() = 0;
|
||||
|
||||
@ -48,6 +51,9 @@ class ByteStreamReader {
|
||||
// An interface for a class that writes to a byte stream.
|
||||
class ByteStreamWriter {
|
||||
public:
|
||||
explicit ByteStreamWriter() = default;
|
||||
virtual ~ByteStreamWriter() = default;
|
||||
|
||||
// Writes |byte| to the stream.
|
||||
virtual void WriteByte(uint8_t byte) = 0;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user