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

Side by Side Diff: util/mach/mach_extensions.cc

Issue 1375573005: mac: Add CrashpadClient::UseSystemDefaultHandler() (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 5 years, 2 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 | « util/mach/mach_extensions.h ('k') | util/mach/mach_extensions_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 "util/mach/mach_extensions.h" 15 #include "util/mach/mach_extensions.h"
16 16
17 #include <AvailabilityMacros.h> 17 #include <AvailabilityMacros.h>
18 #include <pthread.h> 18 #include <pthread.h>
19 #include <servers/bootstrap.h>
19 20
20 #include "base/mac/mach_logging.h" 21 #include "base/mac/mach_logging.h"
21 #include "util/mac/mac_util.h" 22 #include "util/mac/mac_util.h"
22 23
23 namespace crashpad { 24 namespace crashpad {
24 25
25 thread_t MachThreadSelf() { 26 thread_t MachThreadSelf() {
26 // The pthreads library keeps its own copy of the thread port. Using it does 27 // The pthreads library keeps its own copy of the thread port. Using it does
27 // not increment its reference count. 28 // not increment its reference count.
28 return pthread_mach_thread_np(pthread_self()); 29 return pthread_mach_thread_np(pthread_self());
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 return kExcMaskValid_10_6; 90 return kExcMaskValid_10_6;
90 } 91 }
91 #endif 92 #endif
92 93
93 // 10.11 added EXC_MASK_CORPSE_NOTIFY. See 10.11 <mach/exception_types.h>. 94 // 10.11 added EXC_MASK_CORPSE_NOTIFY. See 10.11 <mach/exception_types.h>.
94 const exception_mask_t kExcMaskValid_10_11 = 95 const exception_mask_t kExcMaskValid_10_11 =
95 kExcMaskValid_10_6 | EXC_MASK_CORPSE_NOTIFY; 96 kExcMaskValid_10_6 | EXC_MASK_CORPSE_NOTIFY;
96 return kExcMaskValid_10_11; 97 return kExcMaskValid_10_11;
97 } 98 }
98 99
100 base::mac::ScopedMachSendRight SystemCrashReporterHandler() {
101 const char kSystemCrashReporterServiceName[] = "com.apple.ReportCrash";
102 exception_handler_t system_crash_reporter_handler;
103 kern_return_t kr = bootstrap_look_up(bootstrap_port,
104 kSystemCrashReporterServiceName,
105 &system_crash_reporter_handler);
106 if (kr != BOOTSTRAP_SUCCESS) {
107 BOOTSTRAP_LOG(ERROR, kr) << "bootstrap_look_up "
108 << kSystemCrashReporterServiceName;
109 system_crash_reporter_handler = MACH_PORT_NULL;
110 }
111
112 return base::mac::ScopedMachSendRight(system_crash_reporter_handler);
113 }
114
99 } // namespace crashpad 115 } // namespace crashpad
OLDNEW
« no previous file with comments | « util/mach/mach_extensions.h ('k') | util/mach/mach_extensions_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698