From 0aca1dee17c7cc86293f3575db2d48fa51cc4bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Mon, 29 Mar 2021 10:50:32 +0200 Subject: [PATCH] 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 Commit-Queue: Niels Moller Cr-Commit-Position: refs/heads/master@{#33583} --- test/logging/memory_log_writer.cc | 15 ++++----------- test/logging/memory_log_writer.h | 1 - 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/test/logging/memory_log_writer.cc b/test/logging/memory_log_writer.cc index 2eb1cffb48..f57f0317a9 100644 --- a/test/logging/memory_log_writer.cc +++ b/test/logging/memory_log_writer.cc @@ -21,25 +21,18 @@ class MemoryLogWriter final : public RtcEventLogOutput { explicit MemoryLogWriter(std::map* 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* 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 daef297b88..e795b2fd10 100644 --- a/test/logging/memory_log_writer.h +++ b/test/logging/memory_log_writer.h @@ -15,7 +15,6 @@ #include #include -#include "rtc_base/memory_stream.h" #include "test/logging/log_writer.h" namespace webrtc {