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

Unified Diff: content/public/common/content_debug_logging.h

Issue 10908078: Code to collect issue 97285 debugging info for crash reports. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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: content/public/common/content_debug_logging.h
diff --git a/content/public/common/content_debug_logging.h b/content/public/common/content_debug_logging.h
new file mode 100644
index 0000000000000000000000000000000000000000..1752c36f73bc3f33c063f27c3758b224f8a4e6bd
--- /dev/null
+++ b/content/public/common/content_debug_logging.h
@@ -0,0 +1,54 @@
+// Copyright (c) 2012 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.
+
+#ifndef CONTENT_PUBLIC_BROWSER_CONTENT_DEBUG_LOGGING_H_
+#define CONTENT_PUBLIC_BROWSER_CONTENT_DEBUG_LOGGING_H_
+
+#include "content/common/content_export.h"
+
+#include <string>
+#include <vector>
+
+// When debugging single processes, a common technique is to store
+// breakpad keys which can be analyzed from crashes. That technique
+// does not work well for multi-process bugs. This code can
+// be used to implement a ring buffer in the browser which stores the
+// most-recent N (browser-defined) messages relating to a bug.
+//
+// The intent is that users will call RecordMsg() to record info for
+// the bug, and GetMessages() to fetch the recorded info. In the
+// browser process, these will be backed by a local data structure.
+// In other processes, they will be backed by messages forwarding to
+// the browser process.
+
+// TODO(shess): Since bug notes will be distributed across the code,
+// it would be inconvenient to require some other include to have
+// kBugNNNNN constants for users to use. Those could be in this file,
+// but for now they're a DCHECK in chrome_delegate_main.cc (which
+// implements the actual storage).
+
+namespace content {
+namespace debug {
+
+// Forward to the appropriate handlers.
+CONTENT_EXPORT void RecordMsg(int bug_id, const std::string& msg);
+CONTENT_EXPORT bool GetMessages(int bug_id, std::vector<std::string>* msgs);
+
+// Used to register handlers which will differ per process.
+typedef void RecordMsgFn(int bug_id, const std::string& msg);
+typedef bool GetMessagesFn(int bug_id, std::vector<std::string>* msgs);
+CONTENT_EXPORT void RegisterMessageHandlers(RecordMsgFn* record_handler,
+ GetMessagesFn* get_handler);
+
+// TODO(shess): It would be convenient to expose functions to do things like:
+// - load values into breakpad.
+// - load values into breakpad and dump without crashing.
+// - load values into breakpad and crash.
+// - log values to the console.
+// But this is mostly Chromium-level stuff.
+
+} // namespace debug
+} // namespace content
+
+#endif // CONTENT_PUBLIC_BROWSER_CONTENT_DEBUG_LOGGING_H_

Powered by Google App Engine
This is Rietveld 408576698