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

Side by Side Diff: minidump/minidump_context_writer.cc

Issue 898133002: Use recently imported MSVC warning macros (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: iwyu Created 5 years, 10 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
« no previous file with comments | « no previous file | minidump/minidump_extensions.h » ('j') | minidump/minidump_file_writer_test.cc » ('J')
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_context_writer.h" 15 #include "minidump/minidump_context_writer.h"
16 16
17 #include <string.h> 17 #include <string.h>
18 18
19 #include "base/compiler_specific.h"
19 #include "base/logging.h" 20 #include "base/logging.h"
20 #include "snapshot/cpu_context.h" 21 #include "snapshot/cpu_context.h"
21 #include "util/file/file_writer.h" 22 #include "util/file/file_writer.h"
22 23
23 namespace crashpad { 24 namespace crashpad {
24 25
25 MinidumpContextWriter::~MinidumpContextWriter() { 26 MinidumpContextWriter::~MinidumpContextWriter() {
26 } 27 }
27 28
28 // static 29 // static
29 scoped_ptr<MinidumpContextWriter> MinidumpContextWriter::CreateFromSnapshot( 30 scoped_ptr<MinidumpContextWriter> MinidumpContextWriter::CreateFromSnapshot(
30 const CPUContext* context_snapshot) { 31 const CPUContext* context_snapshot) {
31 scoped_ptr<MinidumpContextWriter> context; 32 scoped_ptr<MinidumpContextWriter> context;
32 33
33 switch (context_snapshot->architecture) { 34 switch (context_snapshot->architecture) {
34 case kCPUArchitectureX86: { 35 case kCPUArchitectureX86: {
35 MinidumpContextX86Writer* context_x86 = new MinidumpContextX86Writer(); 36 MinidumpContextX86Writer* context_x86 = new MinidumpContextX86Writer();
36 context.reset(context_x86); 37 context.reset(context_x86);
37 context_x86->InitializeFromSnapshot(context_snapshot->x86); 38 context_x86->InitializeFromSnapshot(context_snapshot->x86);
38 break; 39 break;
39 } 40 }
40 41
41 case kCPUArchitectureX86_64: { 42 case kCPUArchitectureX86_64: {
42 #if defined(COMPILER_MSVC) && defined(ARCH_CPU_X86) 43 MSVC_PUSH_DISABLE_WARNING(4316); // Object on heap may not be aligned.
43 #pragma warning(push)
44 #pragma warning(disable: 4316) // Object allocated on the heap may not be 16
45 // byte aligned.
46 #endif
47 MinidumpContextAMD64Writer* context_amd64 = 44 MinidumpContextAMD64Writer* context_amd64 =
48 new MinidumpContextAMD64Writer(); 45 new MinidumpContextAMD64Writer();
49 #if defined(COMPILER_MSVC) && defined(ARCH_CPU_X86) 46 MSVC_POP_WARNING(); // C4316
50 #pragma warning(pop)
51 #endif
52 context.reset(context_amd64); 47 context.reset(context_amd64);
53 context_amd64->InitializeFromSnapshot(context_snapshot->x86_64); 48 context_amd64->InitializeFromSnapshot(context_snapshot->x86_64);
54 break; 49 break;
55 } 50 }
56 51
57 default: { 52 default: {
58 LOG(ERROR) << "unknown context architecture " 53 LOG(ERROR) << "unknown context architecture "
59 << context_snapshot->architecture; 54 << context_snapshot->architecture;
60 break; 55 break;
61 } 56 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 return file_writer->Write(&context_, sizeof(context_)); 206 return file_writer->Write(&context_, sizeof(context_));
212 } 207 }
213 208
214 size_t MinidumpContextAMD64Writer::ContextSize() const { 209 size_t MinidumpContextAMD64Writer::ContextSize() const {
215 DCHECK_GE(state(), kStateFrozen); 210 DCHECK_GE(state(), kStateFrozen);
216 211
217 return sizeof(context_); 212 return sizeof(context_);
218 } 213 }
219 214
220 } // namespace crashpad 215 } // namespace crashpad
OLDNEW
« no previous file with comments | « no previous file | minidump/minidump_extensions.h » ('j') | minidump/minidump_file_writer_test.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698