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_CRASHPAD_INFO_WRITER_H_ | 15 #ifndef CRASHPAD_MINIDUMP_MINIDUMP_CRASHPAD_INFO_WRITER_H_ |
16 #define CRASHPAD_MINIDUMP_MINIDUMP_CRASHPAD_INFO_WRITER_H_ | 16 #define CRASHPAD_MINIDUMP_MINIDUMP_CRASHPAD_INFO_WRITER_H_ |
17 | 17 |
18 #include <vector> | 18 #include <vector> |
19 | 19 |
20 #include "base/basictypes.h" | 20 #include "base/basictypes.h" |
21 #include "base/memory/scoped_ptr.h" | 21 #include "base/memory/scoped_ptr.h" |
22 #include "minidump/minidump_extensions.h" | 22 #include "minidump/minidump_extensions.h" |
23 #include "minidump/minidump_stream_writer.h" | 23 #include "minidump/minidump_stream_writer.h" |
24 | 24 |
25 namespace crashpad { | 25 namespace crashpad { |
26 | 26 |
27 class MinidumpModuleCrashpadInfoListWriter; | 27 class MinidumpModuleCrashpadInfoListWriter; |
| 28 class MinidumpSimpleStringDictionaryWriter; |
28 class ProcessSnapshot; | 29 class ProcessSnapshot; |
29 | 30 |
30 //! \brief The writer for a MinidumpCrashpadInfo stream in a minidump file. | 31 //! \brief The writer for a MinidumpCrashpadInfo stream in a minidump file. |
31 class MinidumpCrashpadInfoWriter final : public internal::MinidumpStreamWriter { | 32 class MinidumpCrashpadInfoWriter final : public internal::MinidumpStreamWriter { |
32 public: | 33 public: |
33 MinidumpCrashpadInfoWriter(); | 34 MinidumpCrashpadInfoWriter(); |
34 ~MinidumpCrashpadInfoWriter() override; | 35 ~MinidumpCrashpadInfoWriter() override; |
35 | 36 |
36 //! \brief Initializes MinidumpCrashpadInfo based on \a process_snapshot. | 37 //! \brief Initializes MinidumpCrashpadInfo based on \a process_snapshot. |
37 //! | 38 //! |
38 //! This method may add additional structures to the minidump file as children | 39 //! This method may add additional structures to the minidump file as children |
39 //! of the MinidumpCrashpadInfo stream. To do so, it may obtain other | 40 //! of the MinidumpCrashpadInfo stream. To do so, it may obtain other |
40 //! snapshot information from \a process_snapshot, such as a list of | 41 //! snapshot information from \a process_snapshot, such as a list of |
41 //! ModuleSnapshot objects used to initialize | 42 //! ModuleSnapshot objects used to initialize |
42 //! MinidumpCrashpadInfo::module_list. Only data that is considered useful | 43 //! MinidumpCrashpadInfo::module_list. Only data that is considered useful |
43 //! will be included. For module information, usefulness is determined by | 44 //! will be included. For module information, usefulness is determined by |
44 //! MinidumpModuleCrashpadInfoListWriter::IsUseful(). | 45 //! MinidumpModuleCrashpadInfoListWriter::IsUseful(). |
45 //! | 46 //! |
46 //! \param[in] process_snapshot The process snapshot to use as source data. | 47 //! \param[in] process_snapshot The process snapshot to use as source data. |
47 //! | 48 //! |
48 //! \note Valid in #kStateMutable. No mutator methods may be called before | 49 //! \note Valid in #kStateMutable. No mutator methods may be called before |
49 //! this method, and it is not normally necessary to call any mutator | 50 //! this method, and it is not normally necessary to call any mutator |
50 //! methods after this method. | 51 //! methods after this method. |
51 void InitializeFromSnapshot(const ProcessSnapshot* process_snapshot); | 52 void InitializeFromSnapshot(const ProcessSnapshot* process_snapshot); |
52 | 53 |
| 54 //! \brief Arranges for MinidumpCrashpadInfo::simple_annotations to point to |
| 55 //! the MinidumpSimpleStringDictionaryWriter object to be written by \a |
| 56 //! simple_annotations. |
| 57 //! |
| 58 //! This object takes ownership of \a simple_annotations and becomes its |
| 59 //! parent in the overall tree of internal::MinidumpWritable objects. |
| 60 //! |
| 61 //! \note Valid in #kStateMutable. |
| 62 void SetSimpleAnnotations( |
| 63 scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations); |
| 64 |
53 //! \brief Arranges for MinidumpCrashpadInfo::module_list to point to the | 65 //! \brief Arranges for MinidumpCrashpadInfo::module_list to point to the |
54 //! MinidumpModuleCrashpadInfoList object to be written by \a | 66 //! MinidumpModuleCrashpadInfoList object to be written by \a |
55 //! module_list. | 67 //! module_list. |
56 //! | 68 //! |
57 //! This object takes ownership of \a module_list and becomes its parent in | 69 //! This object takes ownership of \a module_list and becomes its parent in |
58 //! the overall tree of internal::MinidumpWritable objects. | 70 //! the overall tree of internal::MinidumpWritable objects. |
59 //! | 71 //! |
60 //! \note Valid in #kStateMutable. | 72 //! \note Valid in #kStateMutable. |
61 void SetModuleList( | 73 void SetModuleList( |
62 scoped_ptr<MinidumpModuleCrashpadInfoListWriter> module_list); | 74 scoped_ptr<MinidumpModuleCrashpadInfoListWriter> module_list); |
(...skipping 12 matching lines...) Expand all Loading... |
75 bool Freeze() override; | 87 bool Freeze() override; |
76 size_t SizeOfObject() override; | 88 size_t SizeOfObject() override; |
77 std::vector<MinidumpWritable*> Children() override; | 89 std::vector<MinidumpWritable*> Children() override; |
78 bool WriteObject(FileWriterInterface* file_writer) override; | 90 bool WriteObject(FileWriterInterface* file_writer) override; |
79 | 91 |
80 // MinidumpStreamWriter: | 92 // MinidumpStreamWriter: |
81 MinidumpStreamType StreamType() const override; | 93 MinidumpStreamType StreamType() const override; |
82 | 94 |
83 private: | 95 private: |
84 MinidumpCrashpadInfo crashpad_info_; | 96 MinidumpCrashpadInfo crashpad_info_; |
| 97 scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations_; |
85 scoped_ptr<MinidumpModuleCrashpadInfoListWriter> module_list_; | 98 scoped_ptr<MinidumpModuleCrashpadInfoListWriter> module_list_; |
86 | 99 |
87 DISALLOW_COPY_AND_ASSIGN(MinidumpCrashpadInfoWriter); | 100 DISALLOW_COPY_AND_ASSIGN(MinidumpCrashpadInfoWriter); |
88 }; | 101 }; |
89 | 102 |
90 } // namespace crashpad | 103 } // namespace crashpad |
91 | 104 |
92 #endif // CRASHPAD_MINIDUMP_MINIDUMP_CRASHPAD_INFO_WRITER_H_ | 105 #endif // CRASHPAD_MINIDUMP_MINIDUMP_CRASHPAD_INFO_WRITER_H_ |
OLD | NEW |