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

Unified Diff: base/logging.h

Issue 2638763004: Report CHECK/DCHECK to test launcher summary output. (Closed)
Patch Set: Use LazyIsntance and stl stack. Created 3 years, 9 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
« no previous file with comments | « no previous file | base/logging.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/logging.h
diff --git a/base/logging.h b/base/logging.h
index 7854e3934e974b4670930d6855f3ab8699a8376f..09ea63de77d65c24e9be3af33e26c6a678c00f29 100644
--- a/base/logging.h
+++ b/base/logging.h
@@ -15,6 +15,7 @@
#include <utility>
#include "base/base_export.h"
+#include "base/callback_forward.h"
#include "base/compiler_specific.h"
#include "base/debug/debugger.h"
#include "base/macros.h"
@@ -141,6 +142,13 @@
// There is the special severity of DFATAL, which logs FATAL in debug mode,
// ERROR in normal mode.
+// Forward declaration of base::StringPiece for LogAssertHandlerFunction.
+namespace base {
+template <typename STRING_TYPE>
Paweł Hajdan Jr. 2017/03/13 15:49:50 For non-trivial types like StringPiece, I'd prefer
alex-ac 2017/03/14 10:23:14 base/strings/string_piece.h includes base/logging.
+class BasicStringPiece;
+typedef BasicStringPiece<std::string> StringPiece;
+}
+
namespace logging {
// TODO(avi): do we want to do a unification of character types here?
@@ -274,11 +282,24 @@ BASE_EXPORT void SetLogItems(bool enable_process_id, bool enable_thread_id,
BASE_EXPORT void SetShowErrorDialogs(bool enable_dialogs);
// Sets the Log Assert Handler that will be used to notify of check failures.
+// Resets Log Assert Handler on object destruction.
// The default handler shows a dialog box and then terminate the process,
// however clients can use this function to override with their own handling
// (e.g. a silent one for Unit Tests)
-typedef void (*LogAssertHandlerFunction)(const std::string& str);
-BASE_EXPORT void SetLogAssertHandler(LogAssertHandlerFunction handler);
+typedef base::Callback<void(const char* file,
+ int line,
+ const base::StringPiece& message,
+ const base::StringPiece& stack_trace)>
+ LogAssertHandlerFunction;
+
+class BASE_EXPORT ScopedLogAssertHandler {
+ public:
+ explicit ScopedLogAssertHandler(LogAssertHandlerFunction handler);
+ ~ScopedLogAssertHandler();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ScopedLogAssertHandler);
+};
// Sets the Log Message Handler that gets passed every log message before
// it's sent to other log destinations (if any).
« no previous file with comments | « no previous file | base/logging.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698