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

Side by Side Diff: minidump/minidump_file_writer.cc

Issue 674153002: minidump: Change the ownership model (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « minidump/minidump_file_writer.h ('k') | minidump/minidump_file_writer_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 24 matching lines...) Expand all
35 35
36 MinidumpFileWriter::~MinidumpFileWriter() { 36 MinidumpFileWriter::~MinidumpFileWriter() {
37 } 37 }
38 38
39 void MinidumpFileWriter::SetTimestamp(time_t timestamp) { 39 void MinidumpFileWriter::SetTimestamp(time_t timestamp) {
40 DCHECK_EQ(state(), kStateMutable); 40 DCHECK_EQ(state(), kStateMutable);
41 41
42 internal::MinidumpWriterUtil::AssignTimeT(&header_.TimeDateStamp, timestamp); 42 internal::MinidumpWriterUtil::AssignTimeT(&header_.TimeDateStamp, timestamp);
43 } 43 }
44 44
45 void MinidumpFileWriter::AddStream(internal::MinidumpStreamWriter* stream) { 45 void MinidumpFileWriter::AddStream(
46 scoped_ptr<internal::MinidumpStreamWriter> stream) {
46 DCHECK_EQ(state(), kStateMutable); 47 DCHECK_EQ(state(), kStateMutable);
47 48
48 MinidumpStreamType stream_type = stream->StreamType(); 49 MinidumpStreamType stream_type = stream->StreamType();
49 50
50 auto rv = stream_types_.insert(stream_type); 51 auto rv = stream_types_.insert(stream_type);
51 CHECK(rv.second) << "stream_type " << stream_type << " already present"; 52 CHECK(rv.second) << "stream_type " << stream_type << " already present";
52 53
53 streams_.push_back(stream); 54 streams_.push_back(stream.release());
54 55
55 DCHECK_EQ(streams_.size(), stream_types_.size()); 56 DCHECK_EQ(streams_.size(), stream_types_.size());
56 } 57 }
57 58
58 bool MinidumpFileWriter::WriteEverything(FileWriterInterface* file_writer) { 59 bool MinidumpFileWriter::WriteEverything(FileWriterInterface* file_writer) {
59 DCHECK_EQ(state(), kStateMutable); 60 DCHECK_EQ(state(), kStateMutable);
60 61
61 off_t start_offset = file_writer->Seek(0, SEEK_CUR); 62 off_t start_offset = file_writer->Seek(0, SEEK_CUR);
62 if (start_offset < 0) { 63 if (start_offset < 0) {
63 return false; 64 return false;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 for (internal::MinidumpStreamWriter* stream : streams_) { 154 for (internal::MinidumpStreamWriter* stream : streams_) {
154 iov.iov_base = stream->DirectoryListEntry(); 155 iov.iov_base = stream->DirectoryListEntry();
155 iov.iov_len = sizeof(MINIDUMP_DIRECTORY); 156 iov.iov_len = sizeof(MINIDUMP_DIRECTORY);
156 iovecs.push_back(iov); 157 iovecs.push_back(iov);
157 } 158 }
158 159
159 return file_writer->WriteIoVec(&iovecs); 160 return file_writer->WriteIoVec(&iovecs);
160 } 161 }
161 162
162 } // namespace crashpad 163 } // namespace crashpad
OLDNEW
« no previous file with comments | « minidump/minidump_file_writer.h ('k') | minidump/minidump_file_writer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698