| 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_SIMPLE_STRING_DICTIONARY_WRITER_H_ | 15 #ifndef CRASHPAD_MINIDUMP_MINIDUMP_SIMPLE_STRING_DICTIONARY_WRITER_H_ |
| 16 #define CRASHPAD_MINIDUMP_MINIDUMP_SIMPLE_STRING_DICTIONARY_WRITER_H_ | 16 #define CRASHPAD_MINIDUMP_MINIDUMP_SIMPLE_STRING_DICTIONARY_WRITER_H_ |
| 17 | 17 |
| 18 #include <sys/types.h> | 18 #include <sys/types.h> |
| 19 | 19 |
| 20 #include <string> | 20 #include <string> |
| 21 #include <map> | 21 #include <map> |
| 22 #include <vector> | 22 #include <vector> |
| 23 | 23 |
| 24 #include "base/basictypes.h" | 24 #include "base/basictypes.h" |
| 25 #include "base/memory/scoped_ptr.h" |
| 25 #include "minidump/minidump_extensions.h" | 26 #include "minidump/minidump_extensions.h" |
| 26 #include "minidump/minidump_string_writer.h" | 27 #include "minidump/minidump_string_writer.h" |
| 27 #include "minidump/minidump_writable.h" | 28 #include "minidump/minidump_writable.h" |
| 28 | 29 |
| 29 namespace crashpad { | 30 namespace crashpad { |
| 30 | 31 |
| 31 //! \brief The writer for a MinidumpSimpleStringDictionaryEntry object in a | 32 //! \brief The writer for a MinidumpSimpleStringDictionaryEntry object in a |
| 32 //! minidump file. | 33 //! minidump file. |
| 33 //! | 34 //! |
| 34 //! Because MinidumpSimpleStringDictionaryEntry objects only appear as elements | 35 //! Because MinidumpSimpleStringDictionaryEntry objects only appear as elements |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 //! entries is insignificant. Entries may be written in any order. | 87 //! entries is insignificant. Entries may be written in any order. |
| 87 class MinidumpSimpleStringDictionaryWriter final | 88 class MinidumpSimpleStringDictionaryWriter final |
| 88 : public internal::MinidumpWritable { | 89 : public internal::MinidumpWritable { |
| 89 public: | 90 public: |
| 90 MinidumpSimpleStringDictionaryWriter(); | 91 MinidumpSimpleStringDictionaryWriter(); |
| 91 ~MinidumpSimpleStringDictionaryWriter(); | 92 ~MinidumpSimpleStringDictionaryWriter(); |
| 92 | 93 |
| 93 //! \brief Adds a MinidumpSimpleStringDictionaryEntryWriter to the | 94 //! \brief Adds a MinidumpSimpleStringDictionaryEntryWriter to the |
| 94 //! MinidumpSimpleStringDictionary. | 95 //! MinidumpSimpleStringDictionary. |
| 95 //! | 96 //! |
| 96 //! \a entry will become a child of this object in the overall tree of | 97 //! This object takes ownership of \a entry and becomes its parent in the |
| 97 //! internal::MinidumpWritable objects. | 98 //! overall tree of internal::MinidumpWritable objects. |
| 98 //! | 99 //! |
| 99 //! If the key contained in \a entry duplicates the key of an entry already | 100 //! If the key contained in \a entry duplicates the key of an entry already |
| 100 //! present in the MinidumpSimpleStringDictionary, the new \a entry will | 101 //! present in the MinidumpSimpleStringDictionary, the new \a entry will |
| 101 //! replace the previous one. | 102 //! replace the previous one. |
| 102 //! | 103 //! |
| 103 //! \note Valid in #kStateMutable. | 104 //! \note Valid in #kStateMutable. |
| 104 void AddEntry(MinidumpSimpleStringDictionaryEntryWriter* entry); | 105 void AddEntry(scoped_ptr<MinidumpSimpleStringDictionaryEntryWriter> entry); |
| 105 | 106 |
| 106 protected: | 107 protected: |
| 107 // MinidumpWritable: | 108 // MinidumpWritable: |
| 108 | 109 |
| 109 bool Freeze() override; | 110 bool Freeze() override; |
| 110 size_t SizeOfObject() override; | 111 size_t SizeOfObject() override; |
| 111 std::vector<MinidumpWritable*> Children() override; | 112 std::vector<MinidumpWritable*> Children() override; |
| 112 bool WriteObject(FileWriterInterface* file_writer) override; | 113 bool WriteObject(FileWriterInterface* file_writer) override; |
| 113 | 114 |
| 114 private: | 115 private: |
| 115 MinidumpSimpleStringDictionary simple_string_dictionary_base_; | 116 MinidumpSimpleStringDictionary simple_string_dictionary_base_; |
| 116 std::map<std::string, MinidumpSimpleStringDictionaryEntryWriter*> | 117 |
| 117 entries_; // weak | 118 // This object owns the MinidumpSimpleStringDictionaryEntryWriter objects. |
| 119 std::map<std::string, MinidumpSimpleStringDictionaryEntryWriter*> entries_; |
| 118 | 120 |
| 119 DISALLOW_COPY_AND_ASSIGN(MinidumpSimpleStringDictionaryWriter); | 121 DISALLOW_COPY_AND_ASSIGN(MinidumpSimpleStringDictionaryWriter); |
| 120 }; | 122 }; |
| 121 | 123 |
| 122 } // namespace crashpad | 124 } // namespace crashpad |
| 123 | 125 |
| 124 #endif // CRASHPAD_MINIDUMP_MINIDUMP_SIMPLE_STRING_DICTIONARY_WRITER_H_ | 126 #endif // CRASHPAD_MINIDUMP_MINIDUMP_SIMPLE_STRING_DICTIONARY_WRITER_H_ |
| OLD | NEW |