| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 CHECK(rv.second) << "stream_type " << stream_type << " already present"; | 118 CHECK(rv.second) << "stream_type " << stream_type << " already present"; |
| 119 | 119 |
| 120 streams_.push_back(stream.release()); | 120 streams_.push_back(stream.release()); |
| 121 | 121 |
| 122 DCHECK_EQ(streams_.size(), stream_types_.size()); | 122 DCHECK_EQ(streams_.size(), stream_types_.size()); |
| 123 } | 123 } |
| 124 | 124 |
| 125 bool MinidumpFileWriter::WriteEverything(FileWriterInterface* file_writer) { | 125 bool MinidumpFileWriter::WriteEverything(FileWriterInterface* file_writer) { |
| 126 DCHECK_EQ(state(), kStateMutable); | 126 DCHECK_EQ(state(), kStateMutable); |
| 127 | 127 |
| 128 off_t start_offset = file_writer->Seek(0, SEEK_CUR); | 128 FileOffset start_offset = file_writer->Seek(0, SEEK_CUR); |
| 129 if (start_offset < 0) { | 129 if (start_offset < 0) { |
| 130 return false; | 130 return false; |
| 131 } | 131 } |
| 132 | 132 |
| 133 if (!MinidumpWritable::WriteEverything(file_writer)) { | 133 if (!MinidumpWritable::WriteEverything(file_writer)) { |
| 134 return false; | 134 return false; |
| 135 } | 135 } |
| 136 | 136 |
| 137 off_t end_offset = file_writer->Seek(0, SEEK_CUR); | 137 FileOffset end_offset = file_writer->Seek(0, SEEK_CUR); |
| 138 if (end_offset < 0) { | 138 if (end_offset < 0) { |
| 139 return false; | 139 return false; |
| 140 } | 140 } |
| 141 | 141 |
| 142 // Now that the entire minidump file has been completely written, go back to | 142 // Now that the entire minidump file has been completely written, go back to |
| 143 // the beginning and rewrite the header with the correct signature to identify | 143 // the beginning and rewrite the header with the correct signature to identify |
| 144 // it as a valid minidump file. | 144 // it as a valid minidump file. |
| 145 header_.Signature = MINIDUMP_SIGNATURE; | 145 header_.Signature = MINIDUMP_SIGNATURE; |
| 146 | 146 |
| 147 if (file_writer->Seek(start_offset, SEEK_SET) != 0) { | 147 if (file_writer->Seek(start_offset, SEEK_SET) != 0) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 for (internal::MinidumpStreamWriter* stream : streams_) { | 220 for (internal::MinidumpStreamWriter* stream : streams_) { |
| 221 iov.iov_base = stream->DirectoryListEntry(); | 221 iov.iov_base = stream->DirectoryListEntry(); |
| 222 iov.iov_len = sizeof(MINIDUMP_DIRECTORY); | 222 iov.iov_len = sizeof(MINIDUMP_DIRECTORY); |
| 223 iovecs.push_back(iov); | 223 iovecs.push_back(iov); |
| 224 } | 224 } |
| 225 | 225 |
| 226 return file_writer->WriteIoVec(&iovecs); | 226 return file_writer->WriteIoVec(&iovecs); |
| 227 } | 227 } |
| 228 | 228 |
| 229 } // namespace crashpad | 229 } // namespace crashpad |
| OLD | NEW |