Add virtual destructors to ByteStream* (#20417)

This commit is contained in:
stuartmorgan 2020-08-11 14:39:14 -07:00 committed by GitHub
parent dbc97c5c01
commit 3242a69ee4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -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); }

View File

@ -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;