| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/mac/crash_logging.h" |
| 6 |
| 7 #import <Foundation/Foundation.h> |
| 8 |
| 9 namespace base { |
| 10 namespace mac { |
| 11 |
| 12 static SetCrashKeyValueFuncPtr g_set_key_func; |
| 13 static ClearCrashKeyValueFuncPtr g_clear_key_func; |
| 14 |
| 15 void SetCrashKeyFunctions(SetCrashKeyValueFuncPtr set_key_func, |
| 16 ClearCrashKeyValueFuncPtr clear_key_func) { |
| 17 g_set_key_func = set_key_func; |
| 18 g_clear_key_func = clear_key_func; |
| 19 } |
| 20 |
| 21 void SetCrashKeyValue(NSString* key, NSString* val) { |
| 22 if (g_set_key_func) |
| 23 g_set_key_func(key, val); |
| 24 } |
| 25 |
| 26 void ClearCrashKey(NSString* key) { |
| 27 if (g_clear_key_func) |
| 28 g_clear_key_func(key); |
| 29 } |
| 30 |
| 31 ScopedCrashKey::ScopedCrashKey(NSString* key, NSString* value) |
| 32 : crash_key_([key retain]) { |
| 33 if (g_set_key_func) |
| 34 g_set_key_func(crash_key_, value); |
| 35 } |
| 36 |
| 37 ScopedCrashKey::~ScopedCrashKey() { |
| 38 if (g_clear_key_func) |
| 39 g_clear_key_func(crash_key_); |
| 40 } |
| 41 |
| 42 } // namespace mac |
| 43 } // namespace base |
| OLD | NEW |