Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(429)

Unified Diff: third_party/crashpad/crashpad/minidump/minidump_user_stream_writer.cc

Issue 2814043003: Update Crashpad to 1f28a123a4c9449e3d7ddad4ff00dacd366d5216 (Closed)
Patch Set: Add missing GN config to fix compile/link. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/crashpad/crashpad/minidump/minidump_user_stream_writer.cc
diff --git a/third_party/crashpad/crashpad/minidump/minidump_user_stream_writer.cc b/third_party/crashpad/crashpad/minidump/minidump_user_stream_writer.cc
index 6520f0f402896fada0d404ca44527d9b51630706..2cd5035217a31692bd4ae4308d481fd50b2a3e78 100644
--- a/third_party/crashpad/crashpad/minidump/minidump_user_stream_writer.cc
+++ b/third_party/crashpad/crashpad/minidump/minidump_user_stream_writer.cc
@@ -56,22 +56,32 @@ class MinidumpUserStreamWriter::SnapshotContentsWriter final
DISALLOW_COPY_AND_ASSIGN(SnapshotContentsWriter);
};
-class MinidumpUserStreamWriter::BufferContentsWriter final
- : public MinidumpUserStreamWriter::ContentsWriter {
+class MinidumpUserStreamWriter::ExtensionStreamContentsWriter final
+ : public MinidumpUserStreamWriter::ContentsWriter,
+ public MinidumpUserExtensionStreamDataSource::Delegate {
public:
- BufferContentsWriter(const void* buffer, size_t buffer_size)
- : buffer_(buffer), buffer_size_(buffer_size) {}
+ explicit ExtensionStreamContentsWriter(
+ std::unique_ptr<MinidumpUserExtensionStreamDataSource> data_source)
+ : data_source_(std::move(data_source)), writer_(nullptr) {}
bool WriteContents(FileWriterInterface* writer) override {
- return writer->Write(buffer_, buffer_size_);
+ DCHECK(!writer_);
+
+ writer_ = writer;
+ return data_source_->ReadStreamData(this);
+ }
+
+ size_t GetSize() const override { return data_source_->StreamDataSize(); }
+
+ bool ExtensionStreamDataSourceRead(const void* data, size_t size) override {
+ return writer_->Write(data, size);
}
- size_t GetSize() const override { return buffer_size_; }
private:
- const void* buffer_;
- size_t buffer_size_;
+ std::unique_ptr<MinidumpUserExtensionStreamDataSource> data_source_;
+ FileWriterInterface* writer_;
- DISALLOW_COPY_AND_ASSIGN(BufferContentsWriter);
+ DISALLOW_COPY_AND_ASSIGN(ExtensionStreamContentsWriter);
};
MinidumpUserStreamWriter::MinidumpUserStreamWriter() : stream_type_() {}
@@ -89,16 +99,14 @@ void MinidumpUserStreamWriter::InitializeFromSnapshot(
base::WrapUnique(new SnapshotContentsWriter(stream->memory()));
}
-void MinidumpUserStreamWriter::InitializeFromBuffer(
- MinidumpStreamType stream_type,
- const void* buffer,
- size_t buffer_size) {
+void MinidumpUserStreamWriter::InitializeFromUserExtensionStream(
+ std::unique_ptr<MinidumpUserExtensionStreamDataSource> data_source) {
DCHECK_EQ(state(), kStateMutable);
DCHECK(!contents_writer_.get());
- stream_type_ = stream_type;
- contents_writer_ =
- base::WrapUnique(new BufferContentsWriter(buffer, buffer_size));
+ stream_type_ = data_source->stream_type();
+ contents_writer_ = base::WrapUnique(
+ new ExtensionStreamContentsWriter(std::move(data_source)));
}
bool MinidumpUserStreamWriter::Freeze() {

Powered by Google App Engine
This is Rietveld 408576698