| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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_CRASHPAD_MODULE_WRITER_H_ | |
| 16 #define CRASHPAD_MINIDUMP_MINIDUMP_CRASHPAD_MODULE_WRITER_H_ | |
| 17 | |
| 18 #include <stdint.h> | |
| 19 | |
| 20 #include <vector> | |
| 21 | |
| 22 #include "base/basictypes.h" | |
| 23 #include "minidump/minidump_extensions.h" | |
| 24 #include "minidump/minidump_writable.h" | |
| 25 | |
| 26 namespace crashpad { | |
| 27 | |
| 28 class MinidumpSimpleStringDictionaryWriter; | |
| 29 | |
| 30 //! \brief The writer for a MinidumpModuleCrashpadInfo object in a minidump | |
| 31 //! file. | |
| 32 class MinidumpModuleCrashpadInfoWriter final | |
| 33 : public internal::MinidumpWritable { | |
| 34 public: | |
| 35 MinidumpModuleCrashpadInfoWriter(); | |
| 36 ~MinidumpModuleCrashpadInfoWriter(); | |
| 37 | |
| 38 //! \brief Sets MinidumpModuleCrashpadInfo::minidump_module_list_index. | |
| 39 void SetMinidumpModuleListIndex(uint32_t minidump_module_list_index) { | |
| 40 module_.minidump_module_list_index = minidump_module_list_index; | |
| 41 } | |
| 42 | |
| 43 //! \brief Arranges for MinidumpModuleCrashpadInfo::simple_annotations to | |
| 44 //! point to the MinidumpSimpleStringDictionaryWriter object to be written | |
| 45 //! by \a simple_annotations. | |
| 46 //! | |
| 47 //! \a simple_annotations will become a child of this object in the overall | |
| 48 //! tree of internal::MinidumpWritable objects. | |
| 49 //! | |
| 50 //! \note Valid in #kStateMutable. | |
| 51 void SetSimpleAnnotations( | |
| 52 MinidumpSimpleStringDictionaryWriter* simple_annotations); | |
| 53 | |
| 54 protected: | |
| 55 // MinidumpWritable: | |
| 56 bool Freeze() override; | |
| 57 size_t SizeOfObject() override; | |
| 58 std::vector<MinidumpWritable*> Children() override; | |
| 59 bool WriteObject(FileWriterInterface* file_writer) override; | |
| 60 | |
| 61 private: | |
| 62 MinidumpModuleCrashpadInfo module_; | |
| 63 MinidumpSimpleStringDictionaryWriter* simple_annotations_; // weak | |
| 64 | |
| 65 DISALLOW_COPY_AND_ASSIGN(MinidumpModuleCrashpadInfoWriter); | |
| 66 }; | |
| 67 | |
| 68 //! \brief The writer for a MinidumpModuleCrashpadInfoList object in a minidump | |
| 69 //! file, containing a list of MinidumpModuleCrashpadInfo objects. | |
| 70 class MinidumpModuleCrashpadInfoListWriter final | |
| 71 : public internal::MinidumpWritable { | |
| 72 public: | |
| 73 MinidumpModuleCrashpadInfoListWriter(); | |
| 74 ~MinidumpModuleCrashpadInfoListWriter(); | |
| 75 | |
| 76 //! \brief Adds a MinidumpModuleCrashpadInfo to the | |
| 77 //! MinidumpModuleCrashpadInfoList. | |
| 78 //! | |
| 79 //! \a module will become a child of this object in the overall tree of | |
| 80 //! internal::MinidumpWritable objects. | |
| 81 //! | |
| 82 //! \note Valid in #kStateMutable. | |
| 83 void AddModule(MinidumpModuleCrashpadInfoWriter* module); | |
| 84 | |
| 85 protected: | |
| 86 // MinidumpWritable: | |
| 87 bool Freeze() override; | |
| 88 size_t SizeOfObject() override; | |
| 89 std::vector<MinidumpWritable*> Children() override; | |
| 90 bool WriteObject(FileWriterInterface* file_writer) override; | |
| 91 | |
| 92 private: | |
| 93 MinidumpModuleCrashpadInfoList module_list_base_; | |
| 94 std::vector<MinidumpModuleCrashpadInfoWriter*> modules_; // weak | |
| 95 std::vector<MINIDUMP_LOCATION_DESCRIPTOR> module_location_descriptors_; | |
| 96 | |
| 97 DISALLOW_COPY_AND_ASSIGN(MinidumpModuleCrashpadInfoListWriter); | |
| 98 }; | |
| 99 | |
| 100 } // namespace crashpad | |
| 101 | |
| 102 #endif // CRASHPAD_MINIDUMP_MINIDUMP_CRASHPAD_MODULE_WRITER_H_ | |
| OLD | NEW |