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_RVA_LIST_WRITER_H_ | 15 #ifndef CRASHPAD_MINIDUMP_RVA_LIST_WRITER_H_ |
16 #define CRASHPAD_MINIDUMP_RVA_LIST_WRITER_H_ | 16 #define CRASHPAD_MINIDUMP_RVA_LIST_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_writable.h" | 26 #include "minidump/minidump_writable.h" |
27 #include "util/stdlib/pointer_container.h" | 27 #include "util/stdlib/pointer_container.h" |
28 | 28 |
29 namespace crashpad { | 29 namespace crashpad { |
| 30 namespace internal { |
30 | 31 |
31 //! \brief The writer for a MinidumpRVAList object in a minidump file, | 32 //! \brief The writer for a MinidumpRVAList object in a minidump file, |
32 //! containing a list of ::RVA pointers. | 33 //! containing a list of ::RVA pointers. |
33 class MinidumpRVAListWriter : public internal::MinidumpWritable { | 34 class MinidumpRVAListWriter : public MinidumpWritable { |
34 protected: | 35 protected: |
35 MinidumpRVAListWriter(); | 36 MinidumpRVAListWriter(); |
36 ~MinidumpRVAListWriter() override; | 37 ~MinidumpRVAListWriter() override; |
37 | 38 |
38 //! \brief Adds an ::RVA referencing an internal::MinidumpWritable to the | 39 //! \brief Adds an ::RVA referencing an MinidumpWritable to the |
39 //! MinidumpRVAList. | 40 //! MinidumpRVAList. |
40 //! | 41 //! |
41 //! This object takes ownership of \a child and becomes its parent in the | 42 //! This object takes ownership of \a child and becomes its parent in the |
42 //! overall tree of internal::MinidumpWritable objects. | 43 //! overall tree of MinidumpWritable objects. |
43 //! | 44 //! |
44 //! To provide type-correctness, subclasses are expected to provide a public | 45 //! To provide type-correctness, subclasses are expected to provide a public |
45 //! method that accepts a `scoped_ptr`-wrapped argument of the proper | 46 //! method that accepts a `scoped_ptr`-wrapped argument of the proper |
46 //! internal::MinidumpWritable subclass, and call this method with that | 47 //! MinidumpWritable subclass, and call this method with that argument. |
47 //! argument. | |
48 //! | 48 //! |
49 //! \note Valid in #kStateMutable. | 49 //! \note Valid in #kStateMutable. |
50 void AddChild(scoped_ptr<MinidumpWritable> child); | 50 void AddChild(scoped_ptr<MinidumpWritable> child); |
51 | 51 |
52 //! \brief Returns `true` if no child objects have been added by AddChild(), | 52 //! \brief Returns `true` if no child objects have been added by AddChild(), |
53 //! and `false` if child objects are present. | 53 //! and `false` if child objects are present. |
54 bool IsEmpty() const { return children_.empty(); } | 54 bool IsEmpty() const { return children_.empty(); } |
55 | 55 |
56 //! \brief Returns an object’s ::RVA objects referencing its children. | 56 //! \brief Returns an object’s ::RVA objects referencing its children. |
57 //! | 57 //! |
58 //! \note The returned vector will be empty until the object advances to | 58 //! \note The returned vector will be empty until the object advances to |
59 //! #kStateFrozen or beyond. | 59 //! #kStateFrozen or beyond. |
60 const std::vector<RVA>& child_rvas() const { return child_rvas_; } | 60 const std::vector<RVA>& child_rvas() const { return child_rvas_; } |
61 | 61 |
62 // MinidumpWritable: | 62 // MinidumpWritable: |
63 bool Freeze() override; | 63 bool Freeze() override; |
64 size_t SizeOfObject() override; | 64 size_t SizeOfObject() override; |
65 std::vector<MinidumpWritable*> Children() override; | 65 std::vector<MinidumpWritable*> Children() override; |
66 bool WriteObject(FileWriterInterface* file_writer) override; | 66 bool WriteObject(FileWriterInterface* file_writer) override; |
67 | 67 |
68 private: | 68 private: |
69 MinidumpRVAList rva_list_base_; | 69 MinidumpRVAList rva_list_base_; |
70 PointerVector<MinidumpWritable> children_; | 70 PointerVector<MinidumpWritable> children_; |
71 std::vector<RVA> child_rvas_; | 71 std::vector<RVA> child_rvas_; |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(MinidumpRVAListWriter); | 73 DISALLOW_COPY_AND_ASSIGN(MinidumpRVAListWriter); |
74 }; | 74 }; |
75 | 75 |
| 76 } // namespace internal |
76 } // namespace crashpad | 77 } // namespace crashpad |
77 | 78 |
78 #endif // CRASHPAD_MINIDUMP_RVA_LIST_WRITER_H_ | 79 #endif // CRASHPAD_MINIDUMP_RVA_LIST_WRITER_H_ |
OLD | NEW |