| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "components/crash/app/breakpad_mac.h" | 5 #import "components/crash/app/breakpad_mac.h" |
| 6 | 6 |
| 7 #include <CoreFoundation/CoreFoundation.h> | 7 #include <CoreFoundation/CoreFoundation.h> |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 // when the application crashes, and provide the user with the option to | 211 // when the application crashes, and provide the user with the option to |
| 212 // restart it. | 212 // restart it. |
| 213 if (is_browser) | 213 if (is_browser) |
| 214 [breakpad_config setObject:@"NO" forKey:@BREAKPAD_SEND_AND_EXIT]; | 214 [breakpad_config setObject:@"NO" forKey:@BREAKPAD_SEND_AND_EXIT]; |
| 215 | 215 |
| 216 base::FilePath dir_crash_dumps; | 216 base::FilePath dir_crash_dumps; |
| 217 GetBreakpadClient()->GetCrashDumpLocation(&dir_crash_dumps); | 217 GetBreakpadClient()->GetCrashDumpLocation(&dir_crash_dumps); |
| 218 [breakpad_config setObject:base::SysUTF8ToNSString(dir_crash_dumps.value()) | 218 [breakpad_config setObject:base::SysUTF8ToNSString(dir_crash_dumps.value()) |
| 219 forKey:@BREAKPAD_DUMP_DIRECTORY]; | 219 forKey:@BREAKPAD_DUMP_DIRECTORY]; |
| 220 | 220 |
| 221 // Temporarily run Breakpad in-process on 10.10 and later because APIs that |
| 222 // it depends on got broken (http://crbug.com/386208). |
| 223 // This can catch crashes in the browser process only. |
| 224 if (is_browser && base::mac::IsOSYosemiteOrLater()) { |
| 225 [breakpad_config setObject:[NSNumber numberWithBool:YES] |
| 226 forKey:@BREAKPAD_IN_PROCESS]; |
| 227 } |
| 228 |
| 221 // Initialize Breakpad. | 229 // Initialize Breakpad. |
| 222 gBreakpadRef = BreakpadCreate(breakpad_config); | 230 gBreakpadRef = BreakpadCreate(breakpad_config); |
| 223 if (!gBreakpadRef) { | 231 if (!gBreakpadRef) { |
| 224 LOG_IF(ERROR, base::mac::AmIBundled()) << "Breakpad initializaiton failed"; | 232 LOG_IF(ERROR, base::mac::AmIBundled()) << "Breakpad initializaiton failed"; |
| 225 return; | 233 return; |
| 226 } | 234 } |
| 227 | 235 |
| 228 // Initialize the scoped crash key system. | 236 // Initialize the scoped crash key system. |
| 229 base::debug::SetCrashKeyReportingFunctions(&SetCrashKeyValueImpl, | 237 base::debug::SetCrashKeyReportingFunctions(&SetCrashKeyValueImpl, |
| 230 &ClearCrashKeyValueImpl); | 238 &ClearCrashKeyValueImpl); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 278 |
| 271 // Store process type in crash dump. | 279 // Store process type in crash dump. |
| 272 SetCrashKeyValue(@"ptype", process_type); | 280 SetCrashKeyValue(@"ptype", process_type); |
| 273 | 281 |
| 274 NSString* pid_value = | 282 NSString* pid_value = |
| 275 [NSString stringWithFormat:@"%d", static_cast<unsigned int>(getpid())]; | 283 [NSString stringWithFormat:@"%d", static_cast<unsigned int>(getpid())]; |
| 276 SetCrashKeyValue(@"pid", pid_value); | 284 SetCrashKeyValue(@"pid", pid_value); |
| 277 } | 285 } |
| 278 | 286 |
| 279 } // namespace breakpad | 287 } // namespace breakpad |
| OLD | NEW |