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

Side by Side Diff: minidump/minidump_thread_writer.cc

Issue 1513573005: Provide std::move() in compat instead of using crashpad::move() (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years 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_system_info_writer_test.cc ('k') | minidump/minidump_thread_writer_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "minidump/minidump_thread_writer.h" 15 #include "minidump/minidump_thread_writer.h"
16 16
17 #include <sys/types.h> 17 #include <sys/types.h>
18 18
19 #include <utility>
20
19 #include "base/logging.h" 21 #include "base/logging.h"
20 #include "minidump/minidump_context_writer.h" 22 #include "minidump/minidump_context_writer.h"
21 #include "minidump/minidump_memory_writer.h" 23 #include "minidump/minidump_memory_writer.h"
22 #include "snapshot/memory_snapshot.h" 24 #include "snapshot/memory_snapshot.h"
23 #include "snapshot/thread_snapshot.h" 25 #include "snapshot/thread_snapshot.h"
24 #include "util/file/file_writer.h" 26 #include "util/file/file_writer.h"
25 #include "util/stdlib/move.h"
26 #include "util/numeric/safe_assignment.h" 27 #include "util/numeric/safe_assignment.h"
27 28
28 namespace crashpad { 29 namespace crashpad {
29 30
30 MinidumpThreadWriter::MinidumpThreadWriter() 31 MinidumpThreadWriter::MinidumpThreadWriter()
31 : MinidumpWritable(), thread_(), stack_(nullptr), context_(nullptr) { 32 : MinidumpWritable(), thread_(), stack_(nullptr), context_(nullptr) {
32 } 33 }
33 34
34 MinidumpThreadWriter::~MinidumpThreadWriter() { 35 MinidumpThreadWriter::~MinidumpThreadWriter() {
35 } 36 }
(...skipping 10 matching lines...) Expand all
46 SetThreadID(thread_id_it->second); 47 SetThreadID(thread_id_it->second);
47 48
48 SetSuspendCount(thread_snapshot->SuspendCount()); 49 SetSuspendCount(thread_snapshot->SuspendCount());
49 SetPriority(thread_snapshot->Priority()); 50 SetPriority(thread_snapshot->Priority());
50 SetTEB(thread_snapshot->ThreadSpecificDataAddress()); 51 SetTEB(thread_snapshot->ThreadSpecificDataAddress());
51 52
52 const MemorySnapshot* stack_snapshot = thread_snapshot->Stack(); 53 const MemorySnapshot* stack_snapshot = thread_snapshot->Stack();
53 if (stack_snapshot && stack_snapshot->Size() > 0) { 54 if (stack_snapshot && stack_snapshot->Size() > 0) {
54 scoped_ptr<MinidumpMemoryWriter> stack = 55 scoped_ptr<MinidumpMemoryWriter> stack =
55 MinidumpMemoryWriter::CreateFromSnapshot(stack_snapshot); 56 MinidumpMemoryWriter::CreateFromSnapshot(stack_snapshot);
56 SetStack(crashpad::move(stack)); 57 SetStack(std::move(stack));
57 } 58 }
58 59
59 scoped_ptr<MinidumpContextWriter> context = 60 scoped_ptr<MinidumpContextWriter> context =
60 MinidumpContextWriter::CreateFromSnapshot(thread_snapshot->Context()); 61 MinidumpContextWriter::CreateFromSnapshot(thread_snapshot->Context());
61 SetContext(crashpad::move(context)); 62 SetContext(std::move(context));
62 } 63 }
63 64
64 const MINIDUMP_THREAD* MinidumpThreadWriter::MinidumpThread() const { 65 const MINIDUMP_THREAD* MinidumpThreadWriter::MinidumpThread() const {
65 DCHECK_EQ(state(), kStateWritable); 66 DCHECK_EQ(state(), kStateWritable);
66 67
67 return &thread_; 68 return &thread_;
68 } 69 }
69 70
70 void MinidumpThreadWriter::SetStack(scoped_ptr<MinidumpMemoryWriter> stack) { 71 void MinidumpThreadWriter::SetStack(scoped_ptr<MinidumpMemoryWriter> stack) {
71 DCHECK_EQ(state(), kStateMutable); 72 DCHECK_EQ(state(), kStateMutable);
72 73
73 stack_ = crashpad::move(stack); 74 stack_ = std::move(stack);
74 } 75 }
75 76
76 void MinidumpThreadWriter::SetContext( 77 void MinidumpThreadWriter::SetContext(
77 scoped_ptr<MinidumpContextWriter> context) { 78 scoped_ptr<MinidumpContextWriter> context) {
78 DCHECK_EQ(state(), kStateMutable); 79 DCHECK_EQ(state(), kStateMutable);
79 80
80 context_ = crashpad::move(context); 81 context_ = std::move(context);
81 } 82 }
82 83
83 bool MinidumpThreadWriter::Freeze() { 84 bool MinidumpThreadWriter::Freeze() {
84 DCHECK_EQ(state(), kStateMutable); 85 DCHECK_EQ(state(), kStateMutable);
85 CHECK(context_); 86 CHECK(context_);
86 87
87 if (!MinidumpWritable::Freeze()) { 88 if (!MinidumpWritable::Freeze()) {
88 return false; 89 return false;
89 } 90 }
90 91
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 const std::vector<const ThreadSnapshot*>& thread_snapshots, 143 const std::vector<const ThreadSnapshot*>& thread_snapshots,
143 MinidumpThreadIDMap* thread_id_map) { 144 MinidumpThreadIDMap* thread_id_map) {
144 DCHECK_EQ(state(), kStateMutable); 145 DCHECK_EQ(state(), kStateMutable);
145 DCHECK(threads_.empty()); 146 DCHECK(threads_.empty());
146 147
147 BuildMinidumpThreadIDMap(thread_snapshots, thread_id_map); 148 BuildMinidumpThreadIDMap(thread_snapshots, thread_id_map);
148 149
149 for (const ThreadSnapshot* thread_snapshot : thread_snapshots) { 150 for (const ThreadSnapshot* thread_snapshot : thread_snapshots) {
150 auto thread = make_scoped_ptr(new MinidumpThreadWriter()); 151 auto thread = make_scoped_ptr(new MinidumpThreadWriter());
151 thread->InitializeFromSnapshot(thread_snapshot, thread_id_map); 152 thread->InitializeFromSnapshot(thread_snapshot, thread_id_map);
152 AddThread(crashpad::move(thread)); 153 AddThread(std::move(thread));
153 } 154 }
154 155
155 // Do this in a separate loop to keep the thread stacks earlier in the dump, 156 // Do this in a separate loop to keep the thread stacks earlier in the dump,
156 // and together. 157 // and together.
157 for (const ThreadSnapshot* thread_snapshot : thread_snapshots) 158 for (const ThreadSnapshot* thread_snapshot : thread_snapshots)
158 memory_list_writer_->AddFromSnapshot(thread_snapshot->ExtraMemory()); 159 memory_list_writer_->AddFromSnapshot(thread_snapshot->ExtraMemory());
159 } 160 }
160 161
161 void MinidumpThreadListWriter::SetMemoryListWriter( 162 void MinidumpThreadListWriter::SetMemoryListWriter(
162 MinidumpMemoryListWriter* memory_list_writer) { 163 MinidumpMemoryListWriter* memory_list_writer) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 } 229 }
229 230
230 return file_writer->WriteIoVec(&iovecs); 231 return file_writer->WriteIoVec(&iovecs);
231 } 232 }
232 233
233 MinidumpStreamType MinidumpThreadListWriter::StreamType() const { 234 MinidumpStreamType MinidumpThreadListWriter::StreamType() const {
234 return kMinidumpStreamTypeThreadList; 235 return kMinidumpStreamTypeThreadList;
235 } 236 }
236 237
237 } // namespace crashpad 238 } // namespace crashpad
OLDNEW
« no previous file with comments | « minidump/minidump_system_info_writer_test.cc ('k') | minidump/minidump_thread_writer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698