OLD | NEW |
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, |
(...skipping 20 matching lines...) Expand all Loading... |
31 } | 31 } |
32 | 32 |
33 MinidumpCrashpadInfoWriter::~MinidumpCrashpadInfoWriter() { | 33 MinidumpCrashpadInfoWriter::~MinidumpCrashpadInfoWriter() { |
34 } | 34 } |
35 | 35 |
36 void MinidumpCrashpadInfoWriter::InitializeFromSnapshot( | 36 void MinidumpCrashpadInfoWriter::InitializeFromSnapshot( |
37 const ProcessSnapshot* process_snapshot) { | 37 const ProcessSnapshot* process_snapshot) { |
38 DCHECK_EQ(state(), kStateMutable); | 38 DCHECK_EQ(state(), kStateMutable); |
39 DCHECK(!module_list_); | 39 DCHECK(!module_list_); |
40 | 40 |
| 41 UUID report_id; |
| 42 process_snapshot->ReportID(&report_id); |
| 43 SetReportID(report_id); |
| 44 |
41 UUID client_id; | 45 UUID client_id; |
42 process_snapshot->ClientID(&client_id); | 46 process_snapshot->ClientID(&client_id); |
43 SetClientID(client_id); | 47 SetClientID(client_id); |
44 | 48 |
45 auto simple_annotations = | 49 auto simple_annotations = |
46 make_scoped_ptr(new MinidumpSimpleStringDictionaryWriter()); | 50 make_scoped_ptr(new MinidumpSimpleStringDictionaryWriter()); |
47 simple_annotations->InitializeFromMap( | 51 simple_annotations->InitializeFromMap( |
48 process_snapshot->AnnotationsSimpleMap()); | 52 process_snapshot->AnnotationsSimpleMap()); |
49 if (simple_annotations->IsUseful()) { | 53 if (simple_annotations->IsUseful()) { |
50 SetSimpleAnnotations(simple_annotations.Pass()); | 54 SetSimpleAnnotations(simple_annotations.Pass()); |
51 } | 55 } |
52 | 56 |
53 auto modules = make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter()); | 57 auto modules = make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter()); |
54 modules->InitializeFromSnapshot(process_snapshot->Modules()); | 58 modules->InitializeFromSnapshot(process_snapshot->Modules()); |
55 | 59 |
56 if (modules->IsUseful()) { | 60 if (modules->IsUseful()) { |
57 SetModuleList(modules.Pass()); | 61 SetModuleList(modules.Pass()); |
58 } | 62 } |
59 } | 63 } |
60 | 64 |
| 65 void MinidumpCrashpadInfoWriter::SetReportID(const UUID& report_id) { |
| 66 DCHECK_EQ(state(), kStateMutable); |
| 67 |
| 68 crashpad_info_.report_id = report_id; |
| 69 } |
| 70 |
61 void MinidumpCrashpadInfoWriter::SetClientID(const UUID& client_id) { | 71 void MinidumpCrashpadInfoWriter::SetClientID(const UUID& client_id) { |
62 DCHECK_EQ(state(), kStateMutable); | 72 DCHECK_EQ(state(), kStateMutable); |
63 | 73 |
64 crashpad_info_.client_id = client_id; | 74 crashpad_info_.client_id = client_id; |
65 } | 75 } |
66 | 76 |
67 void MinidumpCrashpadInfoWriter::SetSimpleAnnotations( | 77 void MinidumpCrashpadInfoWriter::SetSimpleAnnotations( |
68 scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations) { | 78 scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations) { |
69 DCHECK_EQ(state(), kStateMutable); | 79 DCHECK_EQ(state(), kStateMutable); |
70 | 80 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 DCHECK_EQ(state(), kStateWritable); | 131 DCHECK_EQ(state(), kStateWritable); |
122 | 132 |
123 return file_writer->Write(&crashpad_info_, sizeof(crashpad_info_)); | 133 return file_writer->Write(&crashpad_info_, sizeof(crashpad_info_)); |
124 } | 134 } |
125 | 135 |
126 MinidumpStreamType MinidumpCrashpadInfoWriter::StreamType() const { | 136 MinidumpStreamType MinidumpCrashpadInfoWriter::StreamType() const { |
127 return kMinidumpStreamTypeCrashpadInfo; | 137 return kMinidumpStreamTypeCrashpadInfo; |
128 } | 138 } |
129 | 139 |
130 bool MinidumpCrashpadInfoWriter::IsUseful() const { | 140 bool MinidumpCrashpadInfoWriter::IsUseful() const { |
131 return crashpad_info_.client_id != UUID() || | 141 return crashpad_info_.report_id != UUID() || |
| 142 crashpad_info_.client_id != UUID() || |
132 simple_annotations_ || | 143 simple_annotations_ || |
133 module_list_; | 144 module_list_; |
134 } | 145 } |
135 | 146 |
136 } // namespace crashpad | 147 } // namespace crashpad |
OLD | NEW |