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

Side by Side Diff: third_party/crashpad/crashpad/minidump/minidump_thread_writer.h

Issue 1911823002: Convert //third_party from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cacheinvalidation Created 4 years, 8 months 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
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_THREAD_WRITER_H_ 15 #ifndef CRASHPAD_MINIDUMP_MINIDUMP_THREAD_WRITER_H_
16 #define CRASHPAD_MINIDUMP_MINIDUMP_THREAD_WRITER_H_ 16 #define CRASHPAD_MINIDUMP_MINIDUMP_THREAD_WRITER_H_
17 17
18 #include <windows.h> 18 #include <windows.h>
19 #include <dbghelp.h> 19 #include <dbghelp.h>
20 #include <stdint.h> 20 #include <stdint.h>
21 #include <sys/types.h> 21 #include <sys/types.h>
22 22
23 #include <memory>
23 #include <vector> 24 #include <vector>
24 25
25 #include "base/macros.h" 26 #include "base/macros.h"
26 #include "base/memory/scoped_ptr.h"
27 #include "minidump/minidump_stream_writer.h" 27 #include "minidump/minidump_stream_writer.h"
28 #include "minidump/minidump_thread_id_map.h" 28 #include "minidump/minidump_thread_id_map.h"
29 #include "minidump/minidump_writable.h" 29 #include "minidump/minidump_writable.h"
30 #include "util/stdlib/pointer_container.h" 30 #include "util/stdlib/pointer_container.h"
31 31
32 namespace crashpad { 32 namespace crashpad {
33 33
34 class MinidumpContextWriter; 34 class MinidumpContextWriter;
35 class MinidumpMemoryListWriter; 35 class MinidumpMemoryListWriter;
36 class MinidumpMemoryWriter; 36 class MinidumpMemoryWriter;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 //! \note Valid in any state. 82 //! \note Valid in any state.
83 MinidumpMemoryWriter* Stack() const { return stack_.get(); } 83 MinidumpMemoryWriter* Stack() const { return stack_.get(); }
84 84
85 //! \brief Arranges for MINIDUMP_THREAD::Stack to point to the MINIDUMP_MEMORY 85 //! \brief Arranges for MINIDUMP_THREAD::Stack to point to the MINIDUMP_MEMORY
86 //! object to be written by \a stack. 86 //! object to be written by \a stack.
87 //! 87 //!
88 //! This object takes ownership of \a stack and becomes its parent in the 88 //! This object takes ownership of \a stack and becomes its parent in the
89 //! overall tree of internal::MinidumpWritable objects. 89 //! overall tree of internal::MinidumpWritable objects.
90 //! 90 //!
91 //! \note Valid in #kStateMutable. 91 //! \note Valid in #kStateMutable.
92 void SetStack(scoped_ptr<MinidumpMemoryWriter> stack); 92 void SetStack(std::unique_ptr<MinidumpMemoryWriter> stack);
93 93
94 //! \brief Arranges for MINIDUMP_THREAD::ThreadContext to point to the CPU 94 //! \brief Arranges for MINIDUMP_THREAD::ThreadContext to point to the CPU
95 //! context to be written by \a context. 95 //! context to be written by \a context.
96 //! 96 //!
97 //! A context is required in all MINIDUMP_THREAD objects. 97 //! A context is required in all MINIDUMP_THREAD objects.
98 //! 98 //!
99 //! This object takes ownership of \a context and becomes its parent in the 99 //! This object takes ownership of \a context and becomes its parent in the
100 //! overall tree of internal::MinidumpWritable objects. 100 //! overall tree of internal::MinidumpWritable objects.
101 //! 101 //!
102 //! \note Valid in #kStateMutable. 102 //! \note Valid in #kStateMutable.
103 void SetContext(scoped_ptr<MinidumpContextWriter> context); 103 void SetContext(std::unique_ptr<MinidumpContextWriter> context);
104 104
105 //! \brief Sets MINIDUMP_THREAD::ThreadId. 105 //! \brief Sets MINIDUMP_THREAD::ThreadId.
106 void SetThreadID(uint32_t thread_id) { thread_.ThreadId = thread_id; } 106 void SetThreadID(uint32_t thread_id) { thread_.ThreadId = thread_id; }
107 107
108 //! \brief Sets MINIDUMP_THREAD::SuspendCount. 108 //! \brief Sets MINIDUMP_THREAD::SuspendCount.
109 void SetSuspendCount(uint32_t suspend_count) { 109 void SetSuspendCount(uint32_t suspend_count) {
110 thread_.SuspendCount = suspend_count; 110 thread_.SuspendCount = suspend_count;
111 } 111 }
112 112
113 //! \brief Sets MINIDUMP_THREAD::PriorityClass. 113 //! \brief Sets MINIDUMP_THREAD::PriorityClass.
114 void SetPriorityClass(uint32_t priority_class) { 114 void SetPriorityClass(uint32_t priority_class) {
115 thread_.PriorityClass = priority_class; 115 thread_.PriorityClass = priority_class;
116 } 116 }
117 117
118 //! \brief Sets MINIDUMP_THREAD::Priority. 118 //! \brief Sets MINIDUMP_THREAD::Priority.
119 void SetPriority(uint32_t priority) { thread_.Priority = priority; } 119 void SetPriority(uint32_t priority) { thread_.Priority = priority; }
120 120
121 //! \brief Sets MINIDUMP_THREAD::Teb. 121 //! \brief Sets MINIDUMP_THREAD::Teb.
122 void SetTEB(uint64_t teb) { thread_.Teb = teb; } 122 void SetTEB(uint64_t teb) { thread_.Teb = teb; }
123 123
124 protected: 124 protected:
125 // MinidumpWritable: 125 // MinidumpWritable:
126 bool Freeze() override; 126 bool Freeze() override;
127 size_t SizeOfObject() override; 127 size_t SizeOfObject() override;
128 std::vector<MinidumpWritable*> Children() override; 128 std::vector<MinidumpWritable*> Children() override;
129 bool WriteObject(FileWriterInterface* file_writer) override; 129 bool WriteObject(FileWriterInterface* file_writer) override;
130 130
131 private: 131 private:
132 MINIDUMP_THREAD thread_; 132 MINIDUMP_THREAD thread_;
133 scoped_ptr<MinidumpMemoryWriter> stack_; 133 std::unique_ptr<MinidumpMemoryWriter> stack_;
134 scoped_ptr<MinidumpContextWriter> context_; 134 std::unique_ptr<MinidumpContextWriter> context_;
135 135
136 DISALLOW_COPY_AND_ASSIGN(MinidumpThreadWriter); 136 DISALLOW_COPY_AND_ASSIGN(MinidumpThreadWriter);
137 }; 137 };
138 138
139 //! \brief The writer for a MINIDUMP_THREAD_LIST stream in a minidump file, 139 //! \brief The writer for a MINIDUMP_THREAD_LIST stream in a minidump file,
140 //! containing a list of MINIDUMP_THREAD objects. 140 //! containing a list of MINIDUMP_THREAD objects.
141 class MinidumpThreadListWriter final : public internal::MinidumpStreamWriter { 141 class MinidumpThreadListWriter final : public internal::MinidumpStreamWriter {
142 public: 142 public:
143 MinidumpThreadListWriter(); 143 MinidumpThreadListWriter();
144 ~MinidumpThreadListWriter() override; 144 ~MinidumpThreadListWriter() override;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 //! their stacks added to \a memory_list_writer as extra memory. 183 //! their stacks added to \a memory_list_writer as extra memory.
184 //! \note Valid in #kStateMutable. 184 //! \note Valid in #kStateMutable.
185 void SetMemoryListWriter(MinidumpMemoryListWriter* memory_list_writer); 185 void SetMemoryListWriter(MinidumpMemoryListWriter* memory_list_writer);
186 186
187 //! \brief Adds a MinidumpThreadWriter to the MINIDUMP_THREAD_LIST. 187 //! \brief Adds a MinidumpThreadWriter to the MINIDUMP_THREAD_LIST.
188 //! 188 //!
189 //! This object takes ownership of \a thread and becomes its parent in the 189 //! This object takes ownership of \a thread and becomes its parent in the
190 //! overall tree of internal::MinidumpWritable objects. 190 //! overall tree of internal::MinidumpWritable objects.
191 //! 191 //!
192 //! \note Valid in #kStateMutable. 192 //! \note Valid in #kStateMutable.
193 void AddThread(scoped_ptr<MinidumpThreadWriter> thread); 193 void AddThread(std::unique_ptr<MinidumpThreadWriter> thread);
194 194
195 protected: 195 protected:
196 // MinidumpWritable: 196 // MinidumpWritable:
197 bool Freeze() override; 197 bool Freeze() override;
198 size_t SizeOfObject() override; 198 size_t SizeOfObject() override;
199 std::vector<MinidumpWritable*> Children() override; 199 std::vector<MinidumpWritable*> Children() override;
200 bool WriteObject(FileWriterInterface* file_writer) override; 200 bool WriteObject(FileWriterInterface* file_writer) override;
201 201
202 // MinidumpStreamWriter: 202 // MinidumpStreamWriter:
203 MinidumpStreamType StreamType() const override; 203 MinidumpStreamType StreamType() const override;
204 204
205 private: 205 private:
206 PointerVector<MinidumpThreadWriter> threads_; 206 PointerVector<MinidumpThreadWriter> threads_;
207 MinidumpMemoryListWriter* memory_list_writer_; // weak 207 MinidumpMemoryListWriter* memory_list_writer_; // weak
208 MINIDUMP_THREAD_LIST thread_list_base_; 208 MINIDUMP_THREAD_LIST thread_list_base_;
209 209
210 DISALLOW_COPY_AND_ASSIGN(MinidumpThreadListWriter); 210 DISALLOW_COPY_AND_ASSIGN(MinidumpThreadListWriter);
211 }; 211 };
212 212
213 } // namespace crashpad 213 } // namespace crashpad
214 214
215 #endif // CRASHPAD_MINIDUMP_MINIDUMP_THREAD_WRITER_H_ 215 #endif // CRASHPAD_MINIDUMP_MINIDUMP_THREAD_WRITER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698