OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file abstracts differences in logging between NaCl and host | 5 // This file provides ability to stub LOG and CHECK. |
6 // environment. | |
7 | 6 |
8 #ifndef GPU_COMMAND_BUFFER_COMMON_LOGGING_H_ | 7 #ifndef GPU_COMMAND_BUFFER_COMMON_LOGGING_H_ |
9 #define GPU_COMMAND_BUFFER_COMMON_LOGGING_H_ | 8 #define GPU_COMMAND_BUFFER_COMMON_LOGGING_H_ |
10 | 9 |
11 #ifndef __native_client__ | 10 #if defined(__native_client__) |
12 #if defined(TRUSTED_GPU_LIBRARY_BUILD) | 11 #define STUB_LOG_AND_CHECK 1 |
13 // Turn off base/logging macros for the trusted library build. | 12 #endif // __native_client__ |
14 // TODO(dspringer): remove this once building trusted plugins in the Native | 13 |
15 // Client SDK is no longer needed. | 14 #if defined STUB_LOG_AND_CHECK |
16 #define OMIT_DLOG_AND_DCHECK 1 | |
17 #define GPU_LOG DLOG | |
18 #define GPU_CHECK DCHECK | |
19 #else | |
20 #define GPU_LOG LOG | |
21 #define GPU_CHECK CHECK | |
22 #endif // defined(TRUSTED_GPU_LIBRARY_BUILD) | |
23 #include "base/logging.h" | |
24 #else | |
25 #include <sstream> | 15 #include <sstream> |
26 | 16 |
27 #define GPU_LOG LOG | |
28 #define GPU_CHECK CHECK | |
29 // TODO: implement logging through nacl's debug service runtime if | 17 // TODO: implement logging through nacl's debug service runtime if |
30 // available. | 18 // available. |
31 #define CHECK(X) do {} while (0) | 19 #define CHECK(X) do {} while (0) |
32 #define CHECK_EQ(X, Y) do {} while (0) | 20 #define CHECK_EQ(X, Y) do {} while (0) |
33 #define CHECK_NE(X, Y) do {} while (0) | 21 #define CHECK_NE(X, Y) do {} while (0) |
34 #define CHECK_GT(X, Y) do {} while (0) | 22 #define CHECK_GT(X, Y) do {} while (0) |
35 #define CHECK_GE(X, Y) do {} while (0) | 23 #define CHECK_GE(X, Y) do {} while (0) |
36 #define CHECK_LT(X, Y) do {} while (0) | 24 #define CHECK_LT(X, Y) do {} while (0) |
37 #define CHECK_LE(X, Y) do {} while (0) | 25 #define CHECK_LE(X, Y) do {} while (0) |
38 | 26 |
39 #define DCHECK(X) do {} while (0) | 27 #define DCHECK(X) do {} while (0) |
40 #define DCHECK_EQ(X, Y) do {} while (0) | 28 #define DCHECK_EQ(X, Y) do {} while (0) |
41 #define DCHECK_NE(X, Y) do {} while (0) | 29 #define DCHECK_NE(X, Y) do {} while (0) |
42 #define DCHECK_GT(X, Y) do {} while (0) | 30 #define DCHECK_GT(X, Y) do {} while (0) |
43 #define DCHECK_GE(X, Y) do {} while (0) | 31 #define DCHECK_GE(X, Y) do {} while (0) |
44 #define DCHECK_LT(X, Y) do {} while (0) | 32 #define DCHECK_LT(X, Y) do {} while (0) |
45 #define DCHECK_LE(X, Y) do {} while (0) | 33 #define DCHECK_LE(X, Y) do {} while (0) |
46 | 34 |
47 #define LOG(LEVEL) if (0) std::ostringstream() | 35 #define LOG(LEVEL) if (0) std::ostringstream() |
48 #define DLOG(LEVEL) if (0) std::ostringstream() | 36 #define DLOG(LEVEL) if (0) std::ostringstream() |
49 | 37 |
50 #define NOTREACHED() DCHECK(false) | 38 #define NOTREACHED() DCHECK(false) |
51 | 39 |
52 #endif | 40 #else // STUB_LOG_AND_CHECK |
| 41 #include "base/logging.h" |
| 42 #endif // STUB_LOG_AND_CHECK |
53 | 43 |
54 #endif // GPU_COMMAND_BUFFER_COMMON_LOGGING_H_ | 44 #endif // GPU_COMMAND_BUFFER_COMMON_LOGGING_H_ |
OLD | NEW |