| 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 "minidump/minidump_extensions.h" | 22 #include "minidump/minidump_extensions.h" |
| 22 #include "minidump/minidump_stream_writer.h" | 23 #include "minidump/minidump_stream_writer.h" |
| 23 | 24 |
| 24 namespace crashpad { | 25 namespace crashpad { |
| 25 | 26 |
| 26 class MinidumpModuleCrashpadInfoListWriter; | 27 class MinidumpModuleCrashpadInfoListWriter; |
| 27 | 28 |
| 28 //! \brief The writer for a MinidumpCrashpadInfo stream in a minidump file. | 29 //! \brief The writer for a MinidumpCrashpadInfo stream in a minidump file. |
| 29 class MinidumpCrashpadInfoWriter final : public internal::MinidumpStreamWriter { | 30 class MinidumpCrashpadInfoWriter final : public internal::MinidumpStreamWriter { |
| 30 public: | 31 public: |
| 31 MinidumpCrashpadInfoWriter(); | 32 MinidumpCrashpadInfoWriter(); |
| 32 ~MinidumpCrashpadInfoWriter(); | 33 ~MinidumpCrashpadInfoWriter() override; |
| 33 | 34 |
| 34 //! \brief Arranges for MinidumpCrashpadInfo::module_list to point to the | 35 //! \brief Arranges for MinidumpCrashpadInfo::module_list to point to the |
| 35 //! MinidumpModuleCrashpadInfoList object to be written by \a | 36 //! MinidumpModuleCrashpadInfoList object to be written by \a |
| 36 //! module_list. | 37 //! module_list. |
| 37 //! | 38 //! |
| 38 //! \a module_list will become a child of this object in the overall tree of | 39 //! This object takes ownership of \a module_list and becomes its parent in |
| 39 //! internal::MinidumpWritable objects. | 40 //! the overall tree of internal::MinidumpWritable objects. |
| 40 //! | 41 //! |
| 41 //! \note Valid in #kStateMutable. | 42 //! \note Valid in #kStateMutable. |
| 42 void SetModuleList(MinidumpModuleCrashpadInfoListWriter* module_list); | 43 void SetModuleList( |
| 44 scoped_ptr<MinidumpModuleCrashpadInfoListWriter> module_list); |
| 43 | 45 |
| 44 protected: | 46 protected: |
| 45 // MinidumpWritable: | 47 // MinidumpWritable: |
| 46 bool Freeze() override; | 48 bool Freeze() override; |
| 47 size_t SizeOfObject() override; | 49 size_t SizeOfObject() override; |
| 48 std::vector<MinidumpWritable*> Children() override; | 50 std::vector<MinidumpWritable*> Children() override; |
| 49 bool WriteObject(FileWriterInterface* file_writer) override; | 51 bool WriteObject(FileWriterInterface* file_writer) override; |
| 50 | 52 |
| 51 // MinidumpStreamWriter: | 53 // MinidumpStreamWriter: |
| 52 MinidumpStreamType StreamType() const override; | 54 MinidumpStreamType StreamType() const override; |
| 53 | 55 |
| 54 private: | 56 private: |
| 55 MinidumpCrashpadInfo crashpad_info_; | 57 MinidumpCrashpadInfo crashpad_info_; |
| 56 MinidumpModuleCrashpadInfoListWriter* module_list_; // weak | 58 scoped_ptr<MinidumpModuleCrashpadInfoListWriter> module_list_; |
| 57 | 59 |
| 58 DISALLOW_COPY_AND_ASSIGN(MinidumpCrashpadInfoWriter); | 60 DISALLOW_COPY_AND_ASSIGN(MinidumpCrashpadInfoWriter); |
| 59 }; | 61 }; |
| 60 | 62 |
| 61 } // namespace crashpad | 63 } // namespace crashpad |
| 62 | 64 |
| 63 #endif // CRASHPAD_MINIDUMP_MINIDUMP_CRASHPAD_INFO_WRITER_H_ | 65 #endif // CRASHPAD_MINIDUMP_MINIDUMP_CRASHPAD_INFO_WRITER_H_ |
| OLD | NEW |