Use a plain string buffer in MemoryLogWriter
Drop dependency on MemoryStream and the complex Stream interface.
Bug: None
Change-Id: I2226324b10ddbf5606e27bfecb82efdd25929163
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213145
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33583}
diff --git a/test/logging/memory_log_writer.cc b/test/logging/memory_log_writer.cc
index 2eb1cff..f57f031 100644
--- a/test/logging/memory_log_writer.cc
+++ b/test/logging/memory_log_writer.cc
@@ -21,25 +21,18 @@
explicit MemoryLogWriter(std::map<std::string, std::string>* target,
std::string filename)
: target_(target), filename_(filename) {}
- ~MemoryLogWriter() final {
- size_t size;
- buffer_.GetSize(&size);
- target_->insert({filename_, std::string(buffer_.GetBuffer(), size)});
- }
+ ~MemoryLogWriter() final { target_->insert({filename_, std::move(buffer_)}); }
bool IsActive() const override { return true; }
bool Write(const std::string& value) override {
- size_t written;
- int error;
- return buffer_.WriteAll(value.data(), value.size(), &written, &error) ==
- rtc::SR_SUCCESS;
- RTC_DCHECK_EQ(value.size(), written);
+ buffer_.append(value);
+ return true;
}
void Flush() override {}
private:
std::map<std::string, std::string>* const target_;
const std::string filename_;
- rtc::MemoryStream buffer_;
+ std::string buffer_;
};
class MemoryLogWriterFactory : public LogWriterFactoryInterface {
diff --git a/test/logging/memory_log_writer.h b/test/logging/memory_log_writer.h
index daef297..e795b2f 100644
--- a/test/logging/memory_log_writer.h
+++ b/test/logging/memory_log_writer.h
@@ -15,7 +15,6 @@
#include <string>
#include <vector>
-#include "rtc_base/memory_stream.h"
#include "test/logging/log_writer.h"
namespace webrtc {