OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | |
2 // | |
3 // Licensed under the Apache License, Version 2.0 (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 | |
6 // | |
7 // http://www.apache.org/licenses/LICENSE-2.0 | |
8 // | |
9 // Unless required by applicable law or agreed to in writing, software | |
10 // distributed under the License is distributed on an "AS IS" BASIS, | |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 // See the License for the specific language governing permissions and | |
13 // limitations under the License. | |
14 | |
15 #ifndef CRASHPAD_MINIDUMP_MINIDUMP_HANDLE_WRITER_H_ | |
16 #define CRASHPAD_MINIDUMP_MINIDUMP_HANDLE_WRITER_H_ | |
17 | |
18 #include <windows.h> | |
19 #include <dbghelp.h> | |
20 | |
21 #include <vector> | |
22 | |
23 #include "minidump/minidump_stream_writer.h" | |
24 #include "minidump/minidump_string_writer.h" | |
25 #include "minidump/minidump_writable.h" | |
26 #include "snapshot/handle_snapshot.h" | |
27 #include "util/stdlib/pointer_container.h" | |
28 | |
29 namespace crashpad { | |
30 | |
31 //! \brief The writer for a MINIDUMP_HANDLE_DATA_STREAM stream in a minidump | |
32 //! and its contained MINIDUMP_HANDLE_DESCRIPTOR. | |
33 //! | |
34 //! As we currently do not track any data beyond what MINIDUMP_HANDLE_DESCRIPTOR | |
35 //! supports, we only write that type of record rather than the newer | |
36 //! MINIDUMP_HANDLE_DESCRIPTOR_2. | |
Mark Mentovai
2015/10/21 00:04:21
Another difference between this and most of the ot
scottmg
2015/10/21 00:14:15
Yeah, I noticed that but there didn't seem to be a
| |
37 class MinidumpHandleDataWriter final : public internal::MinidumpStreamWriter { | |
38 public: | |
39 MinidumpHandleDataWriter(); | |
40 ~MinidumpHandleDataWriter() override; | |
41 | |
42 //! \brief Adds an MINIDUMP_HANDLE_DESCRIPTOR for each handle in \a | |
43 //! handle_snapshot to the MINIDUMP_HANDLE_DATA_STREAM. | |
44 //! | |
45 //! \param[in] handle_snapshots The handle snapshots to use as source data. | |
46 //! | |
47 //! \note Valid in #kStateMutable. | |
48 void InitializeFromSnapshot( | |
49 const std::vector<HandleSnapshot>& handle_snapshots); | |
50 | |
51 protected: | |
52 // MinidumpWritable: | |
53 bool Freeze() override; | |
54 size_t SizeOfObject() override; | |
55 std::vector<MinidumpWritable*> Children() override; | |
56 bool WriteObject(FileWriterInterface* file_writer) override; | |
57 | |
58 // MinidumpStreamWriter: | |
59 MinidumpStreamType StreamType() const override; | |
60 | |
61 private: | |
62 MINIDUMP_HANDLE_DATA_STREAM handle_data_stream_base_; | |
63 std::vector<MINIDUMP_HANDLE_DESCRIPTOR> handle_descriptors_; | |
64 PointerVector<internal::MinidumpUTF16StringWriter> strings_; | |
65 | |
66 DISALLOW_COPY_AND_ASSIGN(MinidumpHandleDataWriter); | |
67 }; | |
68 | |
69 } // namespace crashpad | |
70 | |
71 #endif // CRASHPAD_MINIDUMP_MINIDUMP_HANDLE_WRITER_H_ | |
OLD | NEW |