OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/base_switches.h" | 10 #include "base/base_switches.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 BreakpadRemoveUploadParameter(gBreakpadRef, key); | 50 BreakpadRemoveUploadParameter(gBreakpadRef, key); |
51 } | 51 } |
52 | 52 |
53 } // namespace | 53 } // namespace |
54 | 54 |
55 bool IsCrashReporterEnabled() { | 55 bool IsCrashReporterEnabled() { |
56 return gBreakpadRef != NULL; | 56 return gBreakpadRef != NULL; |
57 } | 57 } |
58 | 58 |
| 59 void DestructCrashReporter() { |
| 60 if (gBreakpadRef) { |
| 61 BreakpadRelease(gBreakpadRef); |
| 62 gBreakpadRef = NULL; |
| 63 } |
| 64 } |
| 65 |
59 // Only called for a branded build of Chrome.app. | 66 // Only called for a branded build of Chrome.app. |
60 void InitCrashReporter() { | 67 void InitCrashReporter() { |
61 DCHECK(!gBreakpadRef); | 68 DCHECK(!gBreakpadRef); |
62 base::mac::ScopedNSAutoreleasePool autorelease_pool; | 69 base::mac::ScopedNSAutoreleasePool autorelease_pool; |
63 | 70 |
64 // Check whether crash reporting should be enabled. If enterprise | 71 // Check whether crash reporting should be enabled. If enterprise |
65 // configuration management controls crash reporting, it takes precedence. | 72 // configuration management controls crash reporting, it takes precedence. |
66 // Otherwise, check whether the user has consented to stats and crash | 73 // Otherwise, check whether the user has consented to stats and crash |
67 // reporting. The browser process can make this determination directly. | 74 // reporting. The browser process can make this determination directly. |
68 // Helper processes may not have access to the disk or to the same data as | 75 // Helper processes may not have access to the disk or to the same data as |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 std::string process_type_switch = | 196 std::string process_type_switch = |
190 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 197 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
191 switches::kProcessType); | 198 switches::kProcessType); |
192 if (!process_type_switch.empty()) { | 199 if (!process_type_switch.empty()) { |
193 process_type = base::SysUTF8ToNSString(process_type_switch); | 200 process_type = base::SysUTF8ToNSString(process_type_switch); |
194 } | 201 } |
195 | 202 |
196 // Store process type in crash dump. | 203 // Store process type in crash dump. |
197 SetCrashKeyValue(@"ptype", process_type); | 204 SetCrashKeyValue(@"ptype", process_type); |
198 } | 205 } |
OLD | NEW |