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

Side by Side Diff: chrome/app/breakpad_mac.mm

Issue 11761030: Create the crash key registration system and register some Mac-specific keys. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Android/Win compile Created 7 years, 11 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 | Annotate | Revision Log
OLDNEW
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"
11 #include "base/base_switches.h" 11 #include "base/base_switches.h"
12 #import "base/basictypes.h" 12 #import "base/basictypes.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/debug/crash_logging.h" 14 #include "base/debug/crash_logging.h"
15 #include "base/file_path.h" 15 #include "base/file_path.h"
16 #include "base/file_util.h" 16 #include "base/file_util.h"
17 #import "base/logging.h" 17 #import "base/logging.h"
18 #include "base/mac/bundle_locations.h" 18 #include "base/mac/bundle_locations.h"
19 #include "base/mac/mac_util.h" 19 #include "base/mac/mac_util.h"
20 #include "base/mac/scoped_cftyperef.h" 20 #include "base/mac/scoped_cftyperef.h"
21 #import "base/mac/scoped_nsautorelease_pool.h" 21 #import "base/mac/scoped_nsautorelease_pool.h"
22 #include "base/path_service.h" 22 #include "base/path_service.h"
23 #include "base/sys_string_conversions.h" 23 #include "base/sys_string_conversions.h"
24 #include "base/threading/platform_thread.h" 24 #include "base/threading/platform_thread.h"
25 #include "base/threading/thread_restrictions.h" 25 #include "base/threading/thread_restrictions.h"
26 #import "breakpad/src/client/mac/Framework/Breakpad.h" 26 #import "breakpad/src/client/mac/Framework/Breakpad.h"
27 #include "chrome/common/child_process_logging.h" 27 #include "chrome/common/child_process_logging.h"
28 #include "chrome/common/chrome_paths.h" 28 #include "chrome/common/chrome_paths.h"
29 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
30 #include "chrome/common/crash_keys.h"
30 #include "chrome/common/env_vars.h" 31 #include "chrome/common/env_vars.h"
31 #include "chrome/common/logging_chrome.h" 32 #include "chrome/common/logging_chrome.h"
32 #include "chrome/installer/util/google_update_settings.h" 33 #include "chrome/installer/util/google_update_settings.h"
33 #include "native_client/src/trusted/service_runtime/osx/crash_filter.h" 34 #include "native_client/src/trusted/service_runtime/osx/crash_filter.h"
34 #include "policy/policy_constants.h" 35 #include "policy/policy_constants.h"
35 36
36 namespace { 37 namespace {
37 38
38 BreakpadRef gBreakpadRef = NULL; 39 BreakpadRef gBreakpadRef = NULL;
39 40
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 [breakpad_config setObject:base::SysUTF8ToNSString(dir_crash_dumps.value()) 245 [breakpad_config setObject:base::SysUTF8ToNSString(dir_crash_dumps.value())
245 forKey:@BREAKPAD_DUMP_DIRECTORY]; 246 forKey:@BREAKPAD_DUMP_DIRECTORY];
246 247
247 // Initialize Breakpad. 248 // Initialize Breakpad.
248 gBreakpadRef = BreakpadCreate(breakpad_config); 249 gBreakpadRef = BreakpadCreate(breakpad_config);
249 if (!gBreakpadRef) { 250 if (!gBreakpadRef) {
250 LOG_IF(ERROR, base::mac::AmIBundled()) << "Breakpad initializaiton failed"; 251 LOG_IF(ERROR, base::mac::AmIBundled()) << "Breakpad initializaiton failed";
251 return; 252 return;
252 } 253 }
253 254
255 // Initialize the new scoped crash key system.
Mark Mentovai 2013/01/15 21:31:03 It won’t be new three months from now, but nobody’
Robert Sesek 2013/01/15 21:40:50 Done.
256 base::debug::SetCrashKeyReportingFunctions(&SetCrashKeyValueImpl,
257 &ClearCrashKeyValueImpl);
258 crash_keys::RegisterChromeCrashKeys();
259
254 // Set Breakpad metadata values. These values are added to Info.plist during 260 // Set Breakpad metadata values. These values are added to Info.plist during
255 // the branded Google Chrome.app build. 261 // the branded Google Chrome.app build.
256 SetCrashKeyValue(@"ver", [info_dictionary objectForKey:@BREAKPAD_VERSION]); 262 SetCrashKeyValue(@"ver", [info_dictionary objectForKey:@BREAKPAD_VERSION]);
257 SetCrashKeyValue(@"prod", [info_dictionary objectForKey:@BREAKPAD_PRODUCT]); 263 SetCrashKeyValue(@"prod", [info_dictionary objectForKey:@BREAKPAD_PRODUCT]);
258 SetCrashKeyValue(@"plat", @"OS X"); 264 SetCrashKeyValue(@"plat", @"OS X");
259 265
260 // Enable child process crashes to include the page URL.
261 // TODO: Should this only be done for certain process types?
262 base::debug::SetCrashKeyReportingFunctions(&SetCrashKeyValueImpl,
263 &ClearCrashKeyValueImpl);
264
265 if (!is_browser) { 266 if (!is_browser) {
266 // Get the guid from the command line switch. 267 // Get the guid from the command line switch.
267 std::string guid = 268 std::string guid =
268 command_line->GetSwitchValueASCII(switches::kEnableCrashReporter); 269 command_line->GetSwitchValueASCII(switches::kEnableCrashReporter);
269 child_process_logging::SetClientId(guid); 270 child_process_logging::SetClientId(guid);
270 } 271 }
271 272
272 logging::SetLogMessageHandler(&FatalMessageHandler); 273 logging::SetLogMessageHandler(&FatalMessageHandler);
273 logging::SetDumpWithoutCrashingFunction(&DumpHelper::DumpWithoutCrashing); 274 logging::SetDumpWithoutCrashingFunction(&DumpHelper::DumpWithoutCrashing);
274 } 275 }
(...skipping 14 matching lines...) Expand all
289 290
290 #if !defined(DISABLE_NACL) 291 #if !defined(DISABLE_NACL)
291 if (process_type_switch == switches::kNaClLoaderProcess) { 292 if (process_type_switch == switches::kNaClLoaderProcess) {
292 BreakpadSetFilterCallback(gBreakpadRef, NaClBreakpadCrashFilter, NULL); 293 BreakpadSetFilterCallback(gBreakpadRef, NaClBreakpadCrashFilter, NULL);
293 } 294 }
294 #endif 295 #endif
295 296
296 // Store process type in crash dump. 297 // Store process type in crash dump.
297 SetCrashKeyValue(@"ptype", process_type); 298 SetCrashKeyValue(@"ptype", process_type);
298 } 299 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698