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

Unified Diff: base/mac/crash_logging.mm

Issue 7849011: Refactor Mac crash key reporting - move to base/mac/crash_logging.{h,mm} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: base/mac/crash_logging.mm
diff --git a/base/mac/crash_logging.mm b/base/mac/crash_logging.mm
new file mode 100644
index 0000000000000000000000000000000000000000..ce0db392a8239c9b991a9db35395fb1a81d6dfd2
--- /dev/null
+++ b/base/mac/crash_logging.mm
@@ -0,0 +1,43 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/mac/crash_logging.h"
+
+#import <Foundation/Foundation.h>
+
+namespace base {
+namespace mac {
+
+static SetCrashKeyValueFuncPtr g_set_key_func;
+static ClearCrashKeyValueFuncPtr g_clear_key_func;
+
+void SetCrashKeyFunctions(SetCrashKeyValueFuncPtr set_key_func,
+ ClearCrashKeyValueFuncPtr clear_key_func) {
+ g_set_key_func = set_key_func;
+ g_clear_key_func = clear_key_func;
+}
+
+void SetCrashKeyValue(NSString* key, NSString* val) {
+ if (g_set_key_func)
+ g_set_key_func(key, val);
+}
+
+void ClearCrashKey(NSString* key) {
+ if (g_clear_key_func)
+ g_clear_key_func(key);
+}
+
+ScopedCrashKey::ScopedCrashKey(NSString* key, NSString* value)
+ : crash_key_([key retain]) {
+ if (g_set_key_func)
+ g_set_key_func(crash_key_, value);
+}
+
+ScopedCrashKey::~ScopedCrashKey() {
+ if (g_clear_key_func)
+ g_clear_key_func(crash_key_);
+}
+
+} // namespace mac
+} // namespace base

Powered by Google App Engine
This is Rietveld 408576698