OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 contains the ErrorState class. | 5 // This file contains the ErrorState class. |
6 | 6 |
7 #ifndef GPU_COMMAND_BUFFER_SERVICE_ERROR_STATE_H_ | 7 #ifndef GPU_COMMAND_BUFFER_SERVICE_ERROR_STATE_H_ |
8 #define GPU_COMMAND_BUFFER_SERVICE_ERROR_STATE_H_ | 8 #define GPU_COMMAND_BUFFER_SERVICE_ERROR_STATE_H_ |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // you can see if that call generates an error. | 48 // you can see if that call generates an error. |
49 #define ERRORSTATE_COPY_REAL_GL_ERRORS_TO_WRAPPER(error_state, function_name) \ | 49 #define ERRORSTATE_COPY_REAL_GL_ERRORS_TO_WRAPPER(error_state, function_name) \ |
50 error_state->CopyRealGLErrorsToWrapper(__FILE__, __LINE__, function_name) | 50 error_state->CopyRealGLErrorsToWrapper(__FILE__, __LINE__, function_name) |
51 // Use to look at the real GL error and still pass it on to the user. | 51 // Use to look at the real GL error and still pass it on to the user. |
52 #define ERRORSTATE_PEEK_GL_ERROR(error_state, function_name) \ | 52 #define ERRORSTATE_PEEK_GL_ERROR(error_state, function_name) \ |
53 error_state->PeekGLError(__FILE__, __LINE__, function_name) | 53 error_state->PeekGLError(__FILE__, __LINE__, function_name) |
54 // Use to clear all current GL errors. FAILS if there are any. | 54 // Use to clear all current GL errors. FAILS if there are any. |
55 #define ERRORSTATE_CLEAR_REAL_GL_ERRORS(error_state, function_name) \ | 55 #define ERRORSTATE_CLEAR_REAL_GL_ERRORS(error_state, function_name) \ |
56 error_state->ClearRealGLErrors(__FILE__, __LINE__, function_name) | 56 error_state->ClearRealGLErrors(__FILE__, __LINE__, function_name) |
57 | 57 |
| 58 class GPU_EXPORT ErrorStateClient { |
| 59 public: |
| 60 // GL_OUT_OF_MEMORY can cause side effects such as losing the context. |
| 61 virtual void OnOutOfMemoryError() = 0; |
| 62 }; |
58 | 63 |
59 class GPU_EXPORT ErrorState { | 64 class GPU_EXPORT ErrorState { |
60 public: | 65 public: |
61 virtual ~ErrorState(); | 66 virtual ~ErrorState(); |
62 | 67 |
63 static ErrorState* Create(Logger* logger); | 68 static ErrorState* Create(ErrorStateClient* client, Logger* logger); |
64 | 69 |
65 virtual uint32 GetGLError() = 0; | 70 virtual uint32 GetGLError() = 0; |
66 | 71 |
67 virtual void SetGLError( | 72 virtual void SetGLError( |
68 const char* filename, | 73 const char* filename, |
69 int line, | 74 int line, |
70 unsigned int error, | 75 unsigned int error, |
71 const char* function_name, | 76 const char* function_name, |
72 const char* msg) = 0; | 77 const char* msg) = 0; |
73 virtual void SetGLErrorInvalidEnum( | 78 virtual void SetGLErrorInvalidEnum( |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 ErrorState(); | 117 ErrorState(); |
113 | 118 |
114 DISALLOW_COPY_AND_ASSIGN(ErrorState); | 119 DISALLOW_COPY_AND_ASSIGN(ErrorState); |
115 }; | 120 }; |
116 | 121 |
117 } // namespace gles2 | 122 } // namespace gles2 |
118 } // namespace gpu | 123 } // namespace gpu |
119 | 124 |
120 #endif // GPU_COMMAND_BUFFER_SERVICE_ERROR_STATE_H_ | 125 #endif // GPU_COMMAND_BUFFER_SERVICE_ERROR_STATE_H_ |
121 | 126 |
OLD | NEW |