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

Side by Side Diff: mojo/edk/util/logging_internal.h

Issue 1426343002: EDK: Move mutex.*, cond_var.*, and thread_annotations.h to //mojo/edk/util. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: oops Created 5 years, 1 month 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
« no previous file with comments | « mojo/edk/util/cond_var_unittest.cc ('k') | mojo/edk/util/logging_internal.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 2015 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 // Internal logging macros, to avoid external dependencies.
6
7 #ifndef MOJO_EDK_UTIL_LOGGING_INTERNAL_H_
8 #define MOJO_EDK_UTIL_LOGGING_INTERNAL_H_
9
10 #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
11
12 #define INTERNAL_DCHECK(condition) \
13 do { \
14 } while (false && (condition))
15
16 #define INTERNAL_DCHECK_WITH_ERRNO(condition, fn, error) \
17 do { \
18 } while (false && (condition) && (error))
19
20 #else
21
22 // Our own simplified "DCHECK". Asserts that |condition| is true. If not, "logs"
23 // the failing condition and aborts.
24 #define INTERNAL_DCHECK(condition) \
25 do { \
26 if (!(condition)) { \
27 ::mojo::util::internal::DcheckHelper(__FILE__, __LINE__, #condition); \
28 } \
29 } while (false)
30
31 // Our own simplified "DCHECK"/"DPCHECK" hybrid. Asserts that |condition| is
32 // true. If not, "logs" |fn| with errno value |error| and aborts. (This doesn't
33 // just use |errno| since some APIs, like pthreads, don't set errno.)
34 #define INTERNAL_DCHECK_WITH_ERRNO(condition, fn, error) \
35 do { \
36 if (!(condition)) { \
37 ::mojo::util::internal::DcheckWithErrnoHelper(__FILE__, __LINE__, fn, \
38 error); \
39 } \
40 } while (false)
41
42 namespace mojo {
43 namespace util {
44 namespace internal {
45
46 // Helper for |INTERNAL_DCHECK_WITH_ERRNO()| above.
47 void DcheckHelper(const char* file, int line, const char* condition_string);
48
49 // Helper for |INTERNAL_DCHECK_WITH_ERRNO()| above.
50 void DcheckWithErrnoHelper(const char* file,
51 int line,
52 const char* fn,
53 int error);
54
55 } // namespace internal
56 } // namespace util
57 } // namespace mojo
58
59 #endif // defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
60
61 #endif // MOJO_EDK_UTIL_LOGGING_INTERNAL_H_
OLDNEW
« no previous file with comments | « mojo/edk/util/cond_var_unittest.cc ('k') | mojo/edk/util/logging_internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698