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 #ifndef GPU_COMMAND_BUFFER_COMMON_LOGGING_H_ | 5 #ifndef GPU_COMMAND_BUFFER_COMMON_LOGGING_H_ |
6 #define GPU_COMMAND_BUFFER_COMMON_LOGGING_H_ | 6 #define GPU_COMMAND_BUFFER_COMMON_LOGGING_H_ |
7 | 7 |
8 #include <assert.h> | 8 #include <assert.h> |
9 | 9 |
10 #include <iostream> | 10 #include <iostream> |
11 | 11 |
12 // Windows defines an ERROR macro. | 12 // Windows defines an ERROR macro. |
13 #ifdef ERROR | 13 #ifdef ERROR |
14 #undef ERROR | 14 #undef ERROR |
15 #endif | 15 #endif |
16 | 16 |
17 namespace gpu { | 17 namespace gpu { |
18 | 18 |
19 // Members are uppercase instead of kCamelCase for consistency with base log | 19 // Members are uppercase instead of kCamelCase for consistency with base log |
20 // severity enum. | 20 // severity enum. |
21 enum LogLevel { | 21 enum LogLevel { |
22 INFO, | 22 INFO, |
23 WARNING, | 23 WARNING, |
24 ERROR, | 24 ERROR, |
25 FATAL, | 25 FATAL |
26 }; | 26 }; |
27 | 27 |
28 // This is a very simple logger for use in command buffer code. Common and | 28 // This is a very simple logger for use in command buffer code. Common and |
29 // command buffer code cannot be dependent on base. It just outputs the message | 29 // command buffer code cannot be dependent on base. It just outputs the message |
30 // to stderr. | 30 // to stderr. |
31 class Logger { | 31 class Logger { |
32 public: | 32 public: |
33 Logger(bool condition, LogLevel level) | 33 Logger(bool condition, LogLevel level) |
34 : condition_(condition), | 34 : condition_(condition), |
35 level_(level) { | 35 level_(level) { |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 (X), (Y), __FILE__, __LINE__, #X, #Y, "GPU_DCHECK_GE") | 187 (X), (Y), __FILE__, __LINE__, #X, #Y, "GPU_DCHECK_GE") |
188 #define GPU_DCHECK_LE(X, Y) ::gpu::Logger::CheckLessEqual( \ | 188 #define GPU_DCHECK_LE(X, Y) ::gpu::Logger::CheckLessEqual( \ |
189 (X), (Y), __FILE__, __LINE__, #X, #Y, "GPU_DCHECK_LE") | 189 (X), (Y), __FILE__, __LINE__, #X, #Y, "GPU_DCHECK_LE") |
190 #define GPU_DLOG(LEVEL) ::gpu::Logger(true, LEVEL) | 190 #define GPU_DLOG(LEVEL) ::gpu::Logger(true, LEVEL) |
191 | 191 |
192 #endif // NDEBUG | 192 #endif // NDEBUG |
193 | 193 |
194 #define GPU_NOTREACHED() GPU_DCHECK(false) | 194 #define GPU_NOTREACHED() GPU_DCHECK(false) |
195 | 195 |
196 #endif // GPU_COMMAND_BUFFER_COMMON_LOGGING_H_ | 196 #endif // GPU_COMMAND_BUFFER_COMMON_LOGGING_H_ |
OLD | NEW |