OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/app/breakpad_mac.h" | 5 #import "chrome/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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 180 |
181 // Tell Breakpad where crash_inspector and crash_report_sender are. | 181 // Tell Breakpad where crash_inspector and crash_report_sender are. |
182 NSString* resource_path = [main_bundle resourcePath]; | 182 NSString* resource_path = [main_bundle resourcePath]; |
183 NSString *inspector_location = | 183 NSString *inspector_location = |
184 [resource_path stringByAppendingPathComponent:@"crash_inspector"]; | 184 [resource_path stringByAppendingPathComponent:@"crash_inspector"]; |
185 NSString *reporter_bundle_location = | 185 NSString *reporter_bundle_location = |
186 [resource_path stringByAppendingPathComponent:@"crash_report_sender.app"]; | 186 [resource_path stringByAppendingPathComponent:@"crash_report_sender.app"]; |
187 NSString *reporter_location = | 187 NSString *reporter_location = |
188 [[NSBundle bundleWithPath:reporter_bundle_location] executablePath]; | 188 [[NSBundle bundleWithPath:reporter_bundle_location] executablePath]; |
189 | 189 |
| 190 if (!inspector_location || !reporter_location) { |
| 191 VLOG_IF(1, is_browser && base::mac::AmIBundled()) << "Breakpad disabled"; |
| 192 return; |
| 193 } |
| 194 |
190 NSDictionary* info_dictionary = [main_bundle infoDictionary]; | 195 NSDictionary* info_dictionary = [main_bundle infoDictionary]; |
191 NSMutableDictionary *breakpad_config = | 196 NSMutableDictionary *breakpad_config = |
192 [[info_dictionary mutableCopy] autorelease]; | 197 [[info_dictionary mutableCopy] autorelease]; |
193 [breakpad_config setObject:inspector_location | 198 [breakpad_config setObject:inspector_location |
194 forKey:@BREAKPAD_INSPECTOR_LOCATION]; | 199 forKey:@BREAKPAD_INSPECTOR_LOCATION]; |
195 [breakpad_config setObject:reporter_location | 200 [breakpad_config setObject:reporter_location |
196 forKey:@BREAKPAD_REPORTER_EXE_LOCATION]; | 201 forKey:@BREAKPAD_REPORTER_EXE_LOCATION]; |
197 | 202 |
198 // In the main application (the browser process), crashes can be passed to | 203 // In the main application (the browser process), crashes can be passed to |
199 // the system's Crash Reporter. This allows the system to notify the user | 204 // the system's Crash Reporter. This allows the system to notify the user |
(...skipping 24 matching lines...) Expand all Loading... |
224 } | 229 } |
225 | 230 |
226 FilePath dir_crash_dumps; | 231 FilePath dir_crash_dumps; |
227 PathService::Get(chrome::DIR_CRASH_DUMPS, &dir_crash_dumps); | 232 PathService::Get(chrome::DIR_CRASH_DUMPS, &dir_crash_dumps); |
228 [breakpad_config setObject:base::SysUTF8ToNSString(dir_crash_dumps.value()) | 233 [breakpad_config setObject:base::SysUTF8ToNSString(dir_crash_dumps.value()) |
229 forKey:@BREAKPAD_DUMP_DIRECTORY]; | 234 forKey:@BREAKPAD_DUMP_DIRECTORY]; |
230 | 235 |
231 // Initialize Breakpad. | 236 // Initialize Breakpad. |
232 gBreakpadRef = BreakpadCreate(breakpad_config); | 237 gBreakpadRef = BreakpadCreate(breakpad_config); |
233 if (!gBreakpadRef) { | 238 if (!gBreakpadRef) { |
234 LOG(ERROR) << "Breakpad initializaiton failed"; | 239 LOG_IF(ERROR, base::mac::AmIBundled()) << "Breakpad initializaiton failed"; |
235 return; | 240 return; |
236 } | 241 } |
237 | 242 |
238 // Set Breakpad metadata values. These values are added to Info.plist during | 243 // Set Breakpad metadata values. These values are added to Info.plist during |
239 // the branded Google Chrome.app build. | 244 // the branded Google Chrome.app build. |
240 SetCrashKeyValue(@"ver", [info_dictionary objectForKey:@BREAKPAD_VERSION]); | 245 SetCrashKeyValue(@"ver", [info_dictionary objectForKey:@BREAKPAD_VERSION]); |
241 SetCrashKeyValue(@"prod", [info_dictionary objectForKey:@BREAKPAD_PRODUCT]); | 246 SetCrashKeyValue(@"prod", [info_dictionary objectForKey:@BREAKPAD_PRODUCT]); |
242 SetCrashKeyValue(@"plat", @"OS X"); | 247 SetCrashKeyValue(@"plat", @"OS X"); |
243 | 248 |
244 // Enable child process crashes to include the page URL. | 249 // Enable child process crashes to include the page URL. |
(...skipping 28 matching lines...) Expand all Loading... |
273 | 278 |
274 #if !defined(DISABLE_NACL) | 279 #if !defined(DISABLE_NACL) |
275 if (process_type_switch == switches::kNaClLoaderProcess) { | 280 if (process_type_switch == switches::kNaClLoaderProcess) { |
276 BreakpadSetFilterCallback(gBreakpadRef, NaClBreakpadCrashFilter, NULL); | 281 BreakpadSetFilterCallback(gBreakpadRef, NaClBreakpadCrashFilter, NULL); |
277 } | 282 } |
278 #endif | 283 #endif |
279 | 284 |
280 // Store process type in crash dump. | 285 // Store process type in crash dump. |
281 SetCrashKeyValue(@"ptype", process_type); | 286 SetCrashKeyValue(@"ptype", process_type); |
282 } | 287 } |
OLD | NEW |