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

Side by Side Diff: content/common/content_debug_logging.cc

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
OLDNEW
(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 "content/public/common/content_debug_logging.h"
6
7 #include "base/logging.h"
8
9 namespace content {
10 namespace debug {
11
12 namespace {
13
14 // These should be initialized by the process as early in main() as
15 // possible, so should be thread-safe.
16 RecordMsgFn* g_record_handler = NULL;
17 GetMessagesFn* g_get_handler = NULL;
18
19 } // namespace
20
21 void RegisterMessageHandlers(RecordMsgFn* record_handler,
22 GetMessagesFn* get_handler) {
23 g_record_handler = record_handler;
24 g_get_handler = get_handler;
25 }
26
27 void RecordMsg(int bug_id, const std::string& msg) {
28 // TODO(shess): It might be useful to log warnings or even DCHECK if
29 // there is no handler, since that implies that the messages are not
30 // being recorded. Unfortunately, it would also cause dirty test
31 // output.
32 if (g_record_handler)
33 (*g_record_handler)(bug_id, msg);
34 }
35
36 bool GetMessages(int bug_id, std::vector<std::string>* msgs) {
37 if (g_get_handler)
38 return (*g_get_handler)(bug_id, msgs);
39
40 msgs->clear();
41 return false;
42 }
43
44 } // namespace debug
45 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_message_filter.cc ('k') | content/common/content_debug_logging_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698