Chromium Code Reviews| Index: mojo/edk/util/logging_internal.cc |
| diff --git a/mojo/edk/util/logging_internal.cc b/mojo/edk/util/logging_internal.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c24e4dcc5bc66da1e19416f92feef299c82795d5 |
| --- /dev/null |
| +++ b/mojo/edk/util/logging_internal.cc |
| @@ -0,0 +1,33 @@ |
| +// Copyright 2015 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 "mojo/edk/util/mutex.h" |
| + |
| +#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) |
| +#include <stdio.h> |
| +#include <stdlib.h> |
| +#include <string.h> |
| + |
| +namespace mojo { |
| +namespace util { |
| +namespace internal { |
| + |
| +void DcheckHelper(const char* file, int line, const char* condition_string) { |
| + fprintf(stderr, "%s:%d: Check failed: %s\n", file, line, condition_string); |
| + abort(); |
| +} |
| + |
| +void DcheckWithErrnoHelper(const char* file, |
| + int line, |
| + const char* fn, |
| + int error) { |
| + fprintf(stderr, "%s:%d: %s: %s\n", file, line, fn, strerror(error)); |
|
jamesr
2015/11/03 22:34:49
this isn't threadsafe
|
| + abort(); |
|
jamesr
2015/11/03 22:34:49
but fuck it, we're going down anyway
|
| +} |
| + |
| +} // namespace internal |
| +} // namespace util |
| +} // namespace mojo |
| + |
| +#endif // !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) |