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

Side by Side 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: Rebase against r155094. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/plugin/plugin_thread.cc ('k') | content/renderer/render_thread_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_PUBLIC_BROWSER_CONTENT_DEBUG_LOGGING_H_
6 #define CONTENT_PUBLIC_BROWSER_CONTENT_DEBUG_LOGGING_H_
7
8 #include "content/common/content_export.h"
9
10 #include <string>
11 #include <vector>
12
13 // When debugging single processes, a common technique is to store
14 // breakpad keys which can be analyzed from crashes. That technique
15 // does not work well for multi-process bugs. This code can
16 // be used to implement a ring buffer in the browser which stores the
17 // most-recent N (browser-defined) messages relating to a bug.
18 //
19 // The intent is that users will call RecordMsg() to record info for
20 // the bug, and GetMessages() to fetch the recorded info. In the
21 // browser process, these will be backed by a local data structure.
22 // In other processes, they will be backed by messages forwarding to
23 // the browser process.
24
25 // TODO(shess): Since bug notes will be distributed across the code,
26 // it would be inconvenient to require some other include to have
27 // kBugNNNNN constants for users to use. Those could be in this file,
28 // but for now they're a DCHECK in chrome_delegate_main.cc (which
29 // implements the actual storage).
30
31 namespace content {
32 namespace debug {
33
34 // RecordMsg() and GetMessages() forward to the handlers set by
35 // RegisterMessageHandlers(). If no handlers are set (or NULL
36 // handlers are set), the messages are simply dropped.
37 //
38 // If GetMessages() returns false, there was no handler (or the
39 // handler was unable to get messages). *msgs will be cleared. If
40 // GetMessages() returns true, zero or more of the most recent
41 // messages previously sent to RecordMsg() will be in *msgs, in the
42 // order recorded, mod things like forwarded delay between processes.
43 CONTENT_EXPORT void RecordMsg(int bug_id, const std::string& msg);
44 CONTENT_EXPORT bool GetMessages(int bug_id, std::vector<std::string>* msgs);
45
46 // Used to register handlers which will differ per process.
47 typedef void RecordMsgFn(int bug_id, const std::string& msg);
48 typedef bool GetMessagesFn(int bug_id, std::vector<std::string>* msgs);
49 CONTENT_EXPORT void RegisterMessageHandlers(RecordMsgFn* record_handler,
50 GetMessagesFn* get_handler);
51
52 // TODO(shess): It would be convenient to expose functions to do things like:
53 // - load values into breakpad.
54 // - load values into breakpad and dump without crashing.
55 // - load values into breakpad and crash.
56 // - log values to the console.
57 // But this is mostly Chromium-level stuff.
58
59 } // namespace debug
60 } // namespace content
61
62 #endif // CONTENT_PUBLIC_BROWSER_CONTENT_DEBUG_LOGGING_H_
OLDNEW
« no previous file with comments | « content/plugin/plugin_thread.cc ('k') | content/renderer/render_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698