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, |
(...skipping 23 matching lines...) Expand all Loading... |
34 MinidumpContextWriter() : MinidumpWritable() {} | 34 MinidumpContextWriter() : MinidumpWritable() {} |
35 | 35 |
36 //! \brief Returns the size of the context structure that this object will | 36 //! \brief Returns the size of the context structure that this object will |
37 //! write. | 37 //! write. |
38 //! | 38 //! |
39 //! \note This method will only be called in #kStateFrozen or a subsequent | 39 //! \note This method will only be called in #kStateFrozen or a subsequent |
40 //! state. | 40 //! state. |
41 virtual size_t ContextSize() const = 0; | 41 virtual size_t ContextSize() const = 0; |
42 | 42 |
43 // MinidumpWritable: | 43 // MinidumpWritable: |
44 virtual size_t SizeOfObject() override final; | 44 size_t SizeOfObject() final; |
45 | 45 |
46 private: | 46 private: |
47 DISALLOW_COPY_AND_ASSIGN(MinidumpContextWriter); | 47 DISALLOW_COPY_AND_ASSIGN(MinidumpContextWriter); |
48 }; | 48 }; |
49 | 49 |
50 //! \brief The writer for a MinidumpContextX86 structure in a minidump file. | 50 //! \brief The writer for a MinidumpContextX86 structure in a minidump file. |
51 class MinidumpContextX86Writer final : public MinidumpContextWriter { | 51 class MinidumpContextX86Writer final : public MinidumpContextWriter { |
52 public: | 52 public: |
53 MinidumpContextX86Writer(); | 53 MinidumpContextX86Writer(); |
54 virtual ~MinidumpContextX86Writer(); | 54 virtual ~MinidumpContextX86Writer(); |
55 | 55 |
56 //! \brief Returns a pointer to the context structure that this object will | 56 //! \brief Returns a pointer to the context structure that this object will |
57 //! write. | 57 //! write. |
58 //! | 58 //! |
59 //! \attention This returns a non-`const` pointer to this object’s private | 59 //! \attention This returns a non-`const` pointer to this object’s private |
60 //! data so that a caller can populate the context structure directly. | 60 //! data so that a caller can populate the context structure directly. |
61 //! This is done because providing setter interfaces to each field in the | 61 //! This is done because providing setter interfaces to each field in the |
62 //! context structure would be unwieldy and cumbersome. Care must be taken | 62 //! context structure would be unwieldy and cumbersome. Care must be taken |
63 //! to populate the context structure correctly. The context structure | 63 //! to populate the context structure correctly. The context structure |
64 //! must only be modified while this object is in the #kStateMutable | 64 //! must only be modified while this object is in the #kStateMutable |
65 //! state. | 65 //! state. |
66 MinidumpContextX86* context() { return &context_; } | 66 MinidumpContextX86* context() { return &context_; } |
67 | 67 |
68 protected: | 68 protected: |
69 // MinidumpWritable: | 69 // MinidumpWritable: |
70 virtual bool WriteObject(FileWriterInterface* file_writer) override; | 70 bool WriteObject(FileWriterInterface* file_writer) override; |
71 | 71 |
72 // MinidumpContextWriter: | 72 // MinidumpContextWriter: |
73 virtual size_t ContextSize() const override; | 73 size_t ContextSize() const override; |
74 | 74 |
75 private: | 75 private: |
76 MinidumpContextX86 context_; | 76 MinidumpContextX86 context_; |
77 | 77 |
78 DISALLOW_COPY_AND_ASSIGN(MinidumpContextX86Writer); | 78 DISALLOW_COPY_AND_ASSIGN(MinidumpContextX86Writer); |
79 }; | 79 }; |
80 | 80 |
81 //! \brief The writer for a MinidumpContextAMD64 structure in a minidump file. | 81 //! \brief The writer for a MinidumpContextAMD64 structure in a minidump file. |
82 class MinidumpContextAMD64Writer final : public MinidumpContextWriter { | 82 class MinidumpContextAMD64Writer final : public MinidumpContextWriter { |
83 public: | 83 public: |
84 MinidumpContextAMD64Writer(); | 84 MinidumpContextAMD64Writer(); |
85 virtual ~MinidumpContextAMD64Writer(); | 85 virtual ~MinidumpContextAMD64Writer(); |
86 | 86 |
87 //! \brief Returns a pointer to the context structure that this object will | 87 //! \brief Returns a pointer to the context structure that this object will |
88 //! write. | 88 //! write. |
89 //! | 89 //! |
90 //! \attention This returns a non-`const` pointer to this object’s private | 90 //! \attention This returns a non-`const` pointer to this object’s private |
91 //! data so that a caller can populate the context structure directly. | 91 //! data so that a caller can populate the context structure directly. |
92 //! This is done because providing setter interfaces to each field in the | 92 //! This is done because providing setter interfaces to each field in the |
93 //! context structure would be unwieldy and cumbersome. Care must be taken | 93 //! context structure would be unwieldy and cumbersome. Care must be taken |
94 //! to populate the context structure correctly. The context structure | 94 //! to populate the context structure correctly. The context structure |
95 //! must only be modified while this object is in the #kStateMutable | 95 //! must only be modified while this object is in the #kStateMutable |
96 //! state. | 96 //! state. |
97 MinidumpContextAMD64* context() { return &context_; } | 97 MinidumpContextAMD64* context() { return &context_; } |
98 | 98 |
99 protected: | 99 protected: |
100 // MinidumpWritable: | 100 // MinidumpWritable: |
101 virtual size_t Alignment() override; | 101 size_t Alignment() override; |
102 virtual bool WriteObject(FileWriterInterface* file_writer) override; | 102 bool WriteObject(FileWriterInterface* file_writer) override; |
103 | 103 |
104 // MinidumpContextWriter: | 104 // MinidumpContextWriter: |
105 virtual size_t ContextSize() const override; | 105 size_t ContextSize() const override; |
106 | 106 |
107 private: | 107 private: |
108 MinidumpContextAMD64 context_; | 108 MinidumpContextAMD64 context_; |
109 | 109 |
110 DISALLOW_COPY_AND_ASSIGN(MinidumpContextAMD64Writer); | 110 DISALLOW_COPY_AND_ASSIGN(MinidumpContextAMD64Writer); |
111 }; | 111 }; |
112 | 112 |
113 } // namespace crashpad | 113 } // namespace crashpad |
114 | 114 |
115 #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_WRITER_H_ | 115 #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_WRITER_H_ |
OLD | NEW |