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, |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
13 // limitations under the License. | 13 // limitations under the License. |
14 | 14 |
15 #include "minidump/minidump_memory_writer.h" | 15 #include "minidump/minidump_memory_writer.h" |
16 | 16 |
17 #include "base/auto_reset.h" | 17 #include "base/auto_reset.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "snapshot/memory_snapshot.h" | 19 #include "snapshot/memory_snapshot.h" |
20 #include "util/file/file_writer.h" | 20 #include "util/file/file_writer.h" |
| 21 #include "util/stdlib/move.h" |
21 #include "util/numeric/safe_assignment.h" | 22 #include "util/numeric/safe_assignment.h" |
22 | 23 |
23 namespace crashpad { | 24 namespace crashpad { |
24 namespace { | 25 namespace { |
25 | 26 |
26 class SnapshotMinidumpMemoryWriter final : public MinidumpMemoryWriter, | 27 class SnapshotMinidumpMemoryWriter final : public MinidumpMemoryWriter, |
27 public MemorySnapshot::Delegate { | 28 public MemorySnapshot::Delegate { |
28 public: | 29 public: |
29 explicit SnapshotMinidumpMemoryWriter(const MemorySnapshot* memory_snapshot) | 30 explicit SnapshotMinidumpMemoryWriter(const MemorySnapshot* memory_snapshot) |
30 : MinidumpMemoryWriter(), | 31 : MinidumpMemoryWriter(), |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 MinidumpMemoryListWriter::~MinidumpMemoryListWriter() { | 171 MinidumpMemoryListWriter::~MinidumpMemoryListWriter() { |
171 } | 172 } |
172 | 173 |
173 void MinidumpMemoryListWriter::AddFromSnapshot( | 174 void MinidumpMemoryListWriter::AddFromSnapshot( |
174 const std::vector<const MemorySnapshot*>& memory_snapshots) { | 175 const std::vector<const MemorySnapshot*>& memory_snapshots) { |
175 DCHECK_EQ(state(), kStateMutable); | 176 DCHECK_EQ(state(), kStateMutable); |
176 | 177 |
177 for (const MemorySnapshot* memory_snapshot : memory_snapshots) { | 178 for (const MemorySnapshot* memory_snapshot : memory_snapshots) { |
178 scoped_ptr<MinidumpMemoryWriter> memory = | 179 scoped_ptr<MinidumpMemoryWriter> memory = |
179 MinidumpMemoryWriter::CreateFromSnapshot(memory_snapshot); | 180 MinidumpMemoryWriter::CreateFromSnapshot(memory_snapshot); |
180 AddMemory(memory.Pass()); | 181 AddMemory(crashpad::move(memory)); |
181 } | 182 } |
182 } | 183 } |
183 | 184 |
184 void MinidumpMemoryListWriter::AddMemory( | 185 void MinidumpMemoryListWriter::AddMemory( |
185 scoped_ptr<MinidumpMemoryWriter> memory_writer) { | 186 scoped_ptr<MinidumpMemoryWriter> memory_writer) { |
186 DCHECK_EQ(state(), kStateMutable); | 187 DCHECK_EQ(state(), kStateMutable); |
187 | 188 |
188 AddExtraMemory(memory_writer.get()); | 189 AddExtraMemory(memory_writer.get()); |
189 children_.push_back(memory_writer.release()); | 190 children_.push_back(memory_writer.release()); |
190 } | 191 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 } | 252 } |
252 | 253 |
253 return file_writer->WriteIoVec(&iovecs); | 254 return file_writer->WriteIoVec(&iovecs); |
254 } | 255 } |
255 | 256 |
256 MinidumpStreamType MinidumpMemoryListWriter::StreamType() const { | 257 MinidumpStreamType MinidumpMemoryListWriter::StreamType() const { |
257 return kMinidumpStreamTypeMemoryList; | 258 return kMinidumpStreamTypeMemoryList; |
258 } | 259 } |
259 | 260 |
260 } // namespace crashpad | 261 } // namespace crashpad |
OLD | NEW |