OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |