| 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_writable.h" | 27 #include "minidump/minidump_writable.h" |
| 27 #include "util/stdlib/pointer_container.h" | 28 #include "util/stdlib/pointer_container.h" |
| 28 | 29 |
| 29 namespace crashpad { | 30 namespace crashpad { |
| 30 | 31 |
| 31 class MinidumpSimpleStringDictionaryWriter; | 32 class MinidumpSimpleStringDictionaryWriter; |
| 32 class ModuleSnapshot; | 33 class ModuleSnapshot; |
| 33 | 34 |
| 34 //! \brief The writer for a MinidumpModuleCrashpadInfo object in a minidump | 35 //! \brief The writer for a MinidumpModuleCrashpadInfo object in a minidump |
| 35 //! file. | 36 //! file. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 private: | 93 private: |
| 93 MinidumpModuleCrashpadInfo module_; | 94 MinidumpModuleCrashpadInfo module_; |
| 94 scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations_; | 95 scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations_; |
| 95 | 96 |
| 96 DISALLOW_COPY_AND_ASSIGN(MinidumpModuleCrashpadInfoWriter); | 97 DISALLOW_COPY_AND_ASSIGN(MinidumpModuleCrashpadInfoWriter); |
| 97 }; | 98 }; |
| 98 | 99 |
| 99 //! \brief The writer for a MinidumpModuleCrashpadInfoList object in a minidump | 100 //! \brief The writer for a MinidumpModuleCrashpadInfoList object in a minidump |
| 100 //! file, containing a list of MinidumpModuleCrashpadInfo objects. | 101 //! file, containing a list of MinidumpModuleCrashpadInfo objects. |
| 101 class MinidumpModuleCrashpadInfoListWriter final | 102 class MinidumpModuleCrashpadInfoListWriter final |
| 102 : public internal::MinidumpWritable { | 103 : public MinidumpLocationDescriptorListWriter { |
| 103 public: | 104 public: |
| 104 MinidumpModuleCrashpadInfoListWriter(); | 105 MinidumpModuleCrashpadInfoListWriter(); |
| 105 ~MinidumpModuleCrashpadInfoListWriter() override; | 106 ~MinidumpModuleCrashpadInfoListWriter() override; |
| 106 | 107 |
| 107 //! \brief Adds an initialized MinidumpModuleCrashpadInfo for modules in \a | 108 //! \brief Adds an initialized MinidumpModuleCrashpadInfo for modules in \a |
| 108 //! module_snapshots to the MinidumpModuleCrashpadInfoList. | 109 //! module_snapshots to the MinidumpModuleCrashpadInfoList. |
| 109 //! | 110 //! |
| 110 //! Only modules in \a module_snapshots that would produce a useful | 111 //! Only modules in \a module_snapshots that would produce a useful |
| 111 //! MinidumpModuleCrashpadInfo structure are included. Usefulness is | 112 //! MinidumpModuleCrashpadInfo structure are included. Usefulness is |
| 112 //! determined by MinidumpModuleCrashpadInfoWriter::IsUseful(). | 113 //! determined by MinidumpModuleCrashpadInfoWriter::IsUseful(). |
| 113 //! | 114 //! |
| 114 //! \param[in] module_snapshots The module snapshots to use as source data. | 115 //! \param[in] module_snapshots The module snapshots to use as source data. |
| 115 //! | 116 //! |
| 116 //! \note Valid in #kStateMutable. AddModule() may not be called before this | 117 //! \note Valid in #kStateMutable. AddModule() may not be called before this |
| 117 //! method, and it is not normally necessary to call AddModule() after | 118 //! method, and it is not normally necessary to call AddModule() after |
| 118 //! this method. | 119 //! this method. |
| 119 void InitializeFromSnapshot( | 120 void InitializeFromSnapshot( |
| 120 const std::vector<const ModuleSnapshot*>& module_snapshots); | 121 const std::vector<const ModuleSnapshot*>& module_snapshots); |
| 121 | 122 |
| 122 //! \brief Adds a MinidumpModuleCrashpadInfo to the | 123 //! \brief Adds a MinidumpModuleCrashpadInfo to the |
| 123 //! MinidumpModuleCrashpadInfoList. | 124 //! MinidumpModuleCrashpadInfoList. |
| 124 //! | 125 //! |
| 125 //! This object takes ownership of \a module and becomes its parent in the | 126 //! This object takes ownership of \a module and becomes its parent in the |
| 126 //! overall tree of internal::MinidumpWritable objects. | 127 //! overall tree of internal::MinidumpWritable objects. |
| 127 //! | 128 //! |
| 128 //! \note Valid in #kStateMutable. | 129 //! \note Valid in #kStateMutable. |
| 129 void AddModule(scoped_ptr<MinidumpModuleCrashpadInfoWriter> module); | 130 void AddModule(scoped_ptr<MinidumpModuleCrashpadInfoWriter> module); |
| 130 | 131 |
| 131 protected: | |
| 132 // MinidumpWritable: | |
| 133 bool Freeze() override; | |
| 134 size_t SizeOfObject() override; | |
| 135 std::vector<MinidumpWritable*> Children() override; | |
| 136 bool WriteObject(FileWriterInterface* file_writer) override; | |
| 137 | |
| 138 private: | 132 private: |
| 139 MinidumpModuleCrashpadInfoList module_list_base_; | |
| 140 PointerVector<MinidumpModuleCrashpadInfoWriter> modules_; | |
| 141 std::vector<MINIDUMP_LOCATION_DESCRIPTOR> module_location_descriptors_; | |
| 142 | |
| 143 DISALLOW_COPY_AND_ASSIGN(MinidumpModuleCrashpadInfoListWriter); | 133 DISALLOW_COPY_AND_ASSIGN(MinidumpModuleCrashpadInfoListWriter); |
| 144 }; | 134 }; |
| 145 | 135 |
| 146 } // namespace crashpad | 136 } // namespace crashpad |
| 147 | 137 |
| 148 #endif // CRASHPAD_MINIDUMP_MINIDUMP_MODULE_CRASHPAD_INFO_WRITER_H_ | 138 #endif // CRASHPAD_MINIDUMP_MINIDUMP_MODULE_CRASHPAD_INFO_WRITER_H_ |
| OLD | NEW |