Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: minidump/minidump_crashpad_module_writer.h

Issue 675803002: Add MinidumpCrashpadModule, its list form, their writers, and their tests (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 #include <sys/types.h>
20
21 #include <vector>
22
23 #include "base/basictypes.h"
24 #include "minidump/minidump_extensions.h"
25 #include "minidump/minidump_writable.h"
26
27 namespace crashpad {
28
29 class MinidumpSimpleStringDictionaryWriter;
30
31 //! \brief The writer for a MinidumpCrashpadModule object in a minidump file.
32 class MinidumpCrashpadModuleWriter final : public internal::MinidumpWritable {
33 public:
34 MinidumpCrashpadModuleWriter();
35 ~MinidumpCrashpadModuleWriter();
36
37 //! \brief Sets MinidumpCrashpadModule::minidump_module_list_index.
38 void SetMinidumpModuleListIndex(uint32_t minidump_module_list_index) {
39 crashpad_module_.minidump_module_list_index = minidump_module_list_index;
40 }
41
42 //! \brief Arranges for MinidumpCrashpadModule::simple_annotations to point to
43 //! the MinidumpSimpleStringDictionaryWriter object to be written by \a
44 //! simple_annotations.
45 //!
46 //! \a simple_annotations will become a child of this object in the overall
47 //! tree of internal::MinidumpWritable objects.
48 //!
49 //! \note Valid in #kStateMutable.
50 void SetSimpleAnnotations(
51 MinidumpSimpleStringDictionaryWriter* simple_annotations);
52
53 protected:
54 // MinidumpWritable:
55 bool Freeze() override;
56 size_t SizeOfObject() override;
57 std::vector<MinidumpWritable*> Children() override;
58 bool WriteObject(FileWriterInterface* file_writer) override;
59
60 private:
61 MinidumpCrashpadModule crashpad_module_;
62 MinidumpSimpleStringDictionaryWriter* simple_annotations_; // weak
63
64 DISALLOW_COPY_AND_ASSIGN(MinidumpCrashpadModuleWriter);
65 };
66
67 //! \brief The writer for a MinidumpCrashpadModuleList object in a minidump
68 //! file, containing a list of MinidumpCrashpadModule objects.
69 class MinidumpCrashpadModuleListWriter final
70 : public internal::MinidumpWritable {
71 public:
72 MinidumpCrashpadModuleListWriter();
73 ~MinidumpCrashpadModuleListWriter();
74
75 //! \brief Adds a MinidumpCrashpadModule to the MinidumpCrashpadModuleList.
76 //!
77 //! \a crashpad_module will become a child of this object in the overall tree
78 //! of internal::MinidumpWritable objects.
79 //!
80 //! \note Valid in #kStateMutable.
81 void AddCrashpadModule(MinidumpCrashpadModuleWriter* crashpad_module);
82
83 protected:
84 // MinidumpWritable:
85 bool Freeze() override;
86 size_t SizeOfObject() override;
87 std::vector<MinidumpWritable*> Children() override;
88 bool WriteObject(FileWriterInterface* file_writer) override;
89
90 private:
91 MinidumpCrashpadModuleList crashpad_module_list_base_;
92 std::vector<MinidumpCrashpadModuleWriter*> crashpad_modules_; // weak
93 std::vector<MINIDUMP_LOCATION_DESCRIPTOR>
94 crashpad_module_location_descriptors_;
95
96 DISALLOW_COPY_AND_ASSIGN(MinidumpCrashpadModuleListWriter);
97 };
98
99 } // namespace crashpad
100
101 #endif // CRASHPAD_MINIDUMP_MINIDUMP_CRASHPAD_MODULE_WRITER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698