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

Side by Side Diff: minidump/minidump_location_descriptor_list_writer.h

Issue 707543002: MinidumpLocationDescriptorListWriter (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback 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
« no previous file with comments | « minidump/minidump_extensions.h ('k') | minidump/minidump_location_descriptor_list_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_LOCATION_DESCRIPTOR_LIST_WRITER_H_
16 #define CRASHPAD_MINIDUMP_LOCATION_DESCRIPTOR_LIST_WRITER_H_
17
18 #include <stdint.h>
19 #include <sys/types.h>
20
21 #include <vector>
22
23 #include "base/basictypes.h"
24 #include "base/memory/scoped_ptr.h"
25 #include "minidump/minidump_extensions.h"
26 #include "minidump/minidump_writable.h"
27 #include "util/stdlib/pointer_container.h"
28
29 namespace crashpad {
30
31 //! \brief The writer for a MinidumpLocationDescriptorList object in a minidump
32 //! file, containing a list of MINIDUMP_LOCATION_DESCRIPTOR objects.
33 class MinidumpLocationDescriptorListWriter : public internal::MinidumpWritable {
34 protected:
35 MinidumpLocationDescriptorListWriter();
36 ~MinidumpLocationDescriptorListWriter() override;
37
38 //! \brief Adds a MINIDUMP_LOCATION_DESCRIPTOR referencing an
39 //! internal::MinidumpWritable to the MinidumpLocationDescriptorList.
40 //!
41 //! This object takes ownership of \a child and becomes its parent in the
42 //! overall tree of internal::MinidumpWritable objects.
43 //!
44 //! To provide type-correctness, subclasses are expected to provide a public
45 //! method that accepts a `scoped_ptr`-wrapped argument of the proper
46 //! internal::MinidumpWritable subclass, and call this method with that
47 //! argument.
48 //!
49 //! \note Valid in #kStateMutable.
50 void AddChild(scoped_ptr<MinidumpWritable> child);
51
52 //! \brief Returns `true` if no child objects have been added by AddChild(),
53 //! and `false` if child objects are present.
54 bool IsEmpty() const { return children_.empty(); }
55
56 //! \brief Returns an object’s MINIDUMP_LOCATION_DESCRIPTOR objects
57 //! referencing its children.
58 //!
59 //! \note The returned vector will be empty until the object advances to
60 //! #kStateFrozen or beyond.
61 const std::vector<MINIDUMP_LOCATION_DESCRIPTOR>& child_location_descriptors()
62 const {
63 return child_location_descriptors_;
64 }
65
66 // MinidumpWritable:
67 bool Freeze() override;
68 size_t SizeOfObject() override;
69 std::vector<MinidumpWritable*> Children() override;
70 bool WriteObject(FileWriterInterface* file_writer) override;
71
72 private:
73 MinidumpLocationDescriptorList location_descriptor_list_base_;
74 PointerVector<MinidumpWritable> children_;
75 std::vector<MINIDUMP_LOCATION_DESCRIPTOR> child_location_descriptors_;
76
77 DISALLOW_COPY_AND_ASSIGN(MinidumpLocationDescriptorListWriter);
78 };
79
80 } // namespace crashpad
81
82 #endif // CRASHPAD_MINIDUMP_LOCATION_DESCRIPTOR_LIST_WRITER_H_
OLDNEW
« no previous file with comments | « minidump/minidump_extensions.h ('k') | minidump/minidump_location_descriptor_list_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698