| 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 client_id; |
| 42 process_snapshot->ClientID(&client_id); |
| 43 SetClientID(client_id); |
| 44 |
| 41 auto simple_annotations = | 45 auto simple_annotations = |
| 42 make_scoped_ptr(new MinidumpSimpleStringDictionaryWriter()); | 46 make_scoped_ptr(new MinidumpSimpleStringDictionaryWriter()); |
| 43 simple_annotations->InitializeFromMap( | 47 simple_annotations->InitializeFromMap( |
| 44 process_snapshot->AnnotationsSimpleMap()); | 48 process_snapshot->AnnotationsSimpleMap()); |
| 45 if (simple_annotations->IsUseful()) { | 49 if (simple_annotations->IsUseful()) { |
| 46 SetSimpleAnnotations(simple_annotations.Pass()); | 50 SetSimpleAnnotations(simple_annotations.Pass()); |
| 47 } | 51 } |
| 48 | 52 |
| 49 auto modules = make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter()); | 53 auto modules = make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter()); |
| 50 modules->InitializeFromSnapshot(process_snapshot->Modules()); | 54 modules->InitializeFromSnapshot(process_snapshot->Modules()); |
| 51 | 55 |
| 52 if (modules->IsUseful()) { | 56 if (modules->IsUseful()) { |
| 53 SetModuleList(modules.Pass()); | 57 SetModuleList(modules.Pass()); |
| 54 } | 58 } |
| 55 } | 59 } |
| 56 | 60 |
| 61 void MinidumpCrashpadInfoWriter::SetClientID(const UUID& client_id) { |
| 62 DCHECK_EQ(state(), kStateMutable); |
| 63 |
| 64 crashpad_info_.client_id = client_id; |
| 65 } |
| 66 |
| 57 void MinidumpCrashpadInfoWriter::SetSimpleAnnotations( | 67 void MinidumpCrashpadInfoWriter::SetSimpleAnnotations( |
| 58 scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations) { | 68 scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations) { |
| 59 DCHECK_EQ(state(), kStateMutable); | 69 DCHECK_EQ(state(), kStateMutable); |
| 60 | 70 |
| 61 simple_annotations_ = simple_annotations.Pass(); | 71 simple_annotations_ = simple_annotations.Pass(); |
| 62 } | 72 } |
| 63 | 73 |
| 64 void MinidumpCrashpadInfoWriter::SetModuleList( | 74 void MinidumpCrashpadInfoWriter::SetModuleList( |
| 65 scoped_ptr<MinidumpModuleCrashpadInfoListWriter> module_list) { | 75 scoped_ptr<MinidumpModuleCrashpadInfoListWriter> module_list) { |
| 66 DCHECK_EQ(state(), kStateMutable); | 76 DCHECK_EQ(state(), kStateMutable); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 DCHECK_EQ(state(), kStateWritable); | 121 DCHECK_EQ(state(), kStateWritable); |
| 112 | 122 |
| 113 return file_writer->Write(&crashpad_info_, sizeof(crashpad_info_)); | 123 return file_writer->Write(&crashpad_info_, sizeof(crashpad_info_)); |
| 114 } | 124 } |
| 115 | 125 |
| 116 MinidumpStreamType MinidumpCrashpadInfoWriter::StreamType() const { | 126 MinidumpStreamType MinidumpCrashpadInfoWriter::StreamType() const { |
| 117 return kMinidumpStreamTypeCrashpadInfo; | 127 return kMinidumpStreamTypeCrashpadInfo; |
| 118 } | 128 } |
| 119 | 129 |
| 120 bool MinidumpCrashpadInfoWriter::IsUseful() const { | 130 bool MinidumpCrashpadInfoWriter::IsUseful() const { |
| 121 return simple_annotations_ || module_list_; | 131 return crashpad_info_.client_id != UUID() || |
| 132 simple_annotations_ || |
| 133 module_list_; |
| 122 } | 134 } |
| 123 | 135 |
| 124 } // namespace crashpad | 136 } // namespace crashpad |
| OLD | NEW |