| 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, |
| 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 "snapshot/mac/process_snapshot_mac.h" | 15 #include "snapshot/mac/process_snapshot_mac.h" |
| 16 | 16 |
| 17 #include "util/misc/tri_state.h" |
| 18 |
| 17 namespace crashpad { | 19 namespace crashpad { |
| 18 | 20 |
| 19 ProcessSnapshotMac::ProcessSnapshotMac() | 21 ProcessSnapshotMac::ProcessSnapshotMac() |
| 20 : ProcessSnapshot(), | 22 : ProcessSnapshot(), |
| 21 system_(), | 23 system_(), |
| 22 threads_(), | 24 threads_(), |
| 23 modules_(), | 25 modules_(), |
| 24 exception_(), | 26 exception_(), |
| 25 process_reader_(), | 27 process_reader_(), |
| 26 annotations_simple_map_(), | 28 annotations_simple_map_(), |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 flavor, | 74 flavor, |
| 73 state, | 75 state, |
| 74 state_count)) { | 76 state_count)) { |
| 75 exception_.reset(); | 77 exception_.reset(); |
| 76 return false; | 78 return false; |
| 77 } | 79 } |
| 78 | 80 |
| 79 return true; | 81 return true; |
| 80 } | 82 } |
| 81 | 83 |
| 84 void ProcessSnapshotMac::GetCrashpadOptions( |
| 85 CrashpadInfoClientOptions* options) { |
| 86 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| 87 |
| 88 CrashpadInfoClientOptions local_options; |
| 89 |
| 90 for (internal::ModuleSnapshotMac* module : modules_) { |
| 91 CrashpadInfoClientOptions module_options; |
| 92 module->GetCrashpadOptions(&module_options); |
| 93 |
| 94 if (local_options.crashpad_handler_behavior == TriState::kUnset) { |
| 95 local_options.crashpad_handler_behavior = |
| 96 module_options.crashpad_handler_behavior; |
| 97 } |
| 98 if (local_options.system_crash_reporter_forwarding == TriState::kUnset) { |
| 99 local_options.system_crash_reporter_forwarding = |
| 100 module_options.system_crash_reporter_forwarding; |
| 101 } |
| 102 |
| 103 // If non-default values have been found for all options, the loop can end |
| 104 // early. |
| 105 if (local_options.crashpad_handler_behavior != TriState::kUnset && |
| 106 local_options.system_crash_reporter_forwarding != TriState::kUnset) { |
| 107 break; |
| 108 } |
| 109 } |
| 110 |
| 111 *options = local_options; |
| 112 } |
| 113 |
| 82 pid_t ProcessSnapshotMac::ProcessID() const { | 114 pid_t ProcessSnapshotMac::ProcessID() const { |
| 83 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 115 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| 84 return process_reader_.ProcessID(); | 116 return process_reader_.ProcessID(); |
| 85 } | 117 } |
| 86 | 118 |
| 87 pid_t ProcessSnapshotMac::ParentProcessID() const { | 119 pid_t ProcessSnapshotMac::ParentProcessID() const { |
| 88 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 120 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| 89 return process_reader_.ProcessID(); | 121 return process_reader_.ProcessID(); |
| 90 } | 122 } |
| 91 | 123 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 for (const ProcessReader::Module& process_reader_module : | 189 for (const ProcessReader::Module& process_reader_module : |
| 158 process_reader_modules) { | 190 process_reader_modules) { |
| 159 auto module = make_scoped_ptr(new internal::ModuleSnapshotMac()); | 191 auto module = make_scoped_ptr(new internal::ModuleSnapshotMac()); |
| 160 if (module->Initialize(&process_reader_, process_reader_module)) { | 192 if (module->Initialize(&process_reader_, process_reader_module)) { |
| 161 modules_.push_back(module.release()); | 193 modules_.push_back(module.release()); |
| 162 } | 194 } |
| 163 } | 195 } |
| 164 } | 196 } |
| 165 | 197 |
| 166 } // namespace crashpad | 198 } // namespace crashpad |
| OLD | NEW |