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

Side by Side Diff: minidump/minidump_thread_writer.cc

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