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 #ifndef CRASHPAD_MINIDUMP_MINIDUMP_MODULE_CRASHPAD_INFO_WRITER_H_ | 15 #ifndef CRASHPAD_MINIDUMP_MINIDUMP_MODULE_CRASHPAD_INFO_WRITER_H_ |
16 #define CRASHPAD_MINIDUMP_MINIDUMP_MODULE_CRASHPAD_INFO_WRITER_H_ | 16 #define CRASHPAD_MINIDUMP_MINIDUMP_MODULE_CRASHPAD_INFO_WRITER_H_ |
17 | 17 |
18 #include <stdint.h> | 18 #include <stdint.h> |
19 #include <sys/types.h> | 19 #include <sys/types.h> |
20 | 20 |
21 #include <vector> | 21 #include <vector> |
22 | 22 |
23 #include "base/basictypes.h" | 23 #include "base/basictypes.h" |
24 #include "base/memory/scoped_ptr.h" | 24 #include "base/memory/scoped_ptr.h" |
25 #include "minidump/minidump_extensions.h" | 25 #include "minidump/minidump_extensions.h" |
26 #include "minidump/minidump_location_descriptor_list_writer.h" | 26 #include "minidump/minidump_location_descriptor_list_writer.h" |
| 27 #include "minidump/minidump_string_writer.h" |
27 #include "minidump/minidump_writable.h" | 28 #include "minidump/minidump_writable.h" |
28 #include "util/stdlib/pointer_container.h" | 29 #include "util/stdlib/pointer_container.h" |
29 | 30 |
30 namespace crashpad { | 31 namespace crashpad { |
31 | 32 |
32 class MinidumpSimpleStringDictionaryWriter; | 33 class MinidumpSimpleStringDictionaryWriter; |
33 class ModuleSnapshot; | 34 class ModuleSnapshot; |
34 | 35 |
35 //! \brief The writer for a MinidumpModuleCrashpadInfo object in a minidump | 36 //! \brief The writer for a MinidumpModuleCrashpadInfo object in a minidump |
36 //! file. | 37 //! file. |
(...skipping 19 matching lines...) Expand all Loading... |
56 //! this method, and it is not normally necessary to call any mutator | 57 //! this method, and it is not normally necessary to call any mutator |
57 //! methods after this method. | 58 //! methods after this method. |
58 void InitializeFromSnapshot(const ModuleSnapshot* module_snapshot, | 59 void InitializeFromSnapshot(const ModuleSnapshot* module_snapshot, |
59 size_t module_list_index); | 60 size_t module_list_index); |
60 | 61 |
61 //! \brief Sets MinidumpModuleCrashpadInfo::minidump_module_list_index. | 62 //! \brief Sets MinidumpModuleCrashpadInfo::minidump_module_list_index. |
62 void SetMinidumpModuleListIndex(uint32_t minidump_module_list_index) { | 63 void SetMinidumpModuleListIndex(uint32_t minidump_module_list_index) { |
63 module_.minidump_module_list_index = minidump_module_list_index; | 64 module_.minidump_module_list_index = minidump_module_list_index; |
64 } | 65 } |
65 | 66 |
| 67 //! \brief Arranges for MinidumpModuleCrashpadInfo::list_annotations to point |
| 68 //! to the internal::MinidumpUTF8StringListWriter object to be written by |
| 69 //! \a list_annotations. |
| 70 //! |
| 71 //! This object takes ownership of \a simple_annotations and becomes its |
| 72 //! parent in the overall tree of internal::MinidumpWritable objects. |
| 73 //! |
| 74 //! \note Valid in #kStateMutable. |
| 75 void SetListAnnotations( |
| 76 scoped_ptr<internal::MinidumpUTF8StringListWriter> list_annotations); |
| 77 |
66 //! \brief Arranges for MinidumpModuleCrashpadInfo::simple_annotations to | 78 //! \brief Arranges for MinidumpModuleCrashpadInfo::simple_annotations to |
67 //! point to the MinidumpSimpleStringDictionaryWriter object to be written | 79 //! point to the MinidumpSimpleStringDictionaryWriter object to be written |
68 //! by \a simple_annotations. | 80 //! by \a simple_annotations. |
69 //! | 81 //! |
70 //! This object takes ownership of \a simple_annotations and becomes its | 82 //! This object takes ownership of \a simple_annotations and becomes its |
71 //! parent in the overall tree of internal::MinidumpWritable objects. | 83 //! parent in the overall tree of internal::MinidumpWritable objects. |
72 //! | 84 //! |
73 //! \note Valid in #kStateMutable. | 85 //! \note Valid in #kStateMutable. |
74 void SetSimpleAnnotations( | 86 void SetSimpleAnnotations( |
75 scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations); | 87 scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations); |
76 | 88 |
77 //! \brief Determines whether the object is useful. | 89 //! \brief Determines whether the object is useful. |
78 //! | 90 //! |
79 //! A useful object is one that carries data that makes a meaningful | 91 //! A useful object is one that carries data that makes a meaningful |
80 //! contribution to a minidump file. An object carrying simple annotations | 92 //! contribution to a minidump file. An object carrying list annotations or |
81 //! would be considered useful. | 93 //! simple annotations would be considered useful. |
82 //! | 94 //! |
83 //! \return `true` if the object is useful, `false` otherwise. | 95 //! \return `true` if the object is useful, `false` otherwise. |
84 bool IsUseful() const; | 96 bool IsUseful() const; |
85 | 97 |
86 protected: | 98 protected: |
87 // MinidumpWritable: | 99 // MinidumpWritable: |
88 bool Freeze() override; | 100 bool Freeze() override; |
89 size_t SizeOfObject() override; | 101 size_t SizeOfObject() override; |
90 std::vector<MinidumpWritable*> Children() override; | 102 std::vector<MinidumpWritable*> Children() override; |
91 bool WriteObject(FileWriterInterface* file_writer) override; | 103 bool WriteObject(FileWriterInterface* file_writer) override; |
92 | 104 |
93 private: | 105 private: |
94 MinidumpModuleCrashpadInfo module_; | 106 MinidumpModuleCrashpadInfo module_; |
| 107 scoped_ptr<internal::MinidumpUTF8StringListWriter> list_annotations_; |
95 scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations_; | 108 scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations_; |
96 | 109 |
97 DISALLOW_COPY_AND_ASSIGN(MinidumpModuleCrashpadInfoWriter); | 110 DISALLOW_COPY_AND_ASSIGN(MinidumpModuleCrashpadInfoWriter); |
98 }; | 111 }; |
99 | 112 |
100 //! \brief The writer for a MinidumpModuleCrashpadInfoList object in a minidump | 113 //! \brief The writer for a MinidumpModuleCrashpadInfoList object in a minidump |
101 //! file, containing a list of MinidumpModuleCrashpadInfo objects. | 114 //! file, containing a list of MinidumpModuleCrashpadInfo objects. |
102 class MinidumpModuleCrashpadInfoListWriter final | 115 class MinidumpModuleCrashpadInfoListWriter final |
103 : public MinidumpLocationDescriptorListWriter { | 116 : public MinidumpLocationDescriptorListWriter { |
104 public: | 117 public: |
(...skipping 24 matching lines...) Expand all Loading... |
129 //! \note Valid in #kStateMutable. | 142 //! \note Valid in #kStateMutable. |
130 void AddModule(scoped_ptr<MinidumpModuleCrashpadInfoWriter> module); | 143 void AddModule(scoped_ptr<MinidumpModuleCrashpadInfoWriter> module); |
131 | 144 |
132 private: | 145 private: |
133 DISALLOW_COPY_AND_ASSIGN(MinidumpModuleCrashpadInfoListWriter); | 146 DISALLOW_COPY_AND_ASSIGN(MinidumpModuleCrashpadInfoListWriter); |
134 }; | 147 }; |
135 | 148 |
136 } // namespace crashpad | 149 } // namespace crashpad |
137 | 150 |
138 #endif // CRASHPAD_MINIDUMP_MINIDUMP_MODULE_CRASHPAD_INFO_WRITER_H_ | 151 #endif // CRASHPAD_MINIDUMP_MINIDUMP_MODULE_CRASHPAD_INFO_WRITER_H_ |
OLD | NEW |