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

Side by Side Diff: gpu/command_buffer/service/error_state.cc

Issue 1542513002: Switch to standard integer types in gpu/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 12 months 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
OLDNEW
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 #include "gpu/command_buffer/service/error_state.h" 5 #include "gpu/command_buffer/service/error_state.h"
6 6
7 #include <stdint.h>
8
7 #include <string> 9 #include <string>
8 10
11 #include "base/macros.h"
9 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
11 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 14 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
12 #include "gpu/command_buffer/service/logger.h" 15 #include "gpu/command_buffer/service/logger.h"
13 #include "ui/gl/gl_bindings.h" 16 #include "ui/gl/gl_bindings.h"
14 17
15 namespace gpu { 18 namespace gpu {
16 namespace gles2 { 19 namespace gles2 {
17 20
18 class ErrorStateImpl : public ErrorState { 21 class ErrorStateImpl : public ErrorState {
19 public: 22 public:
20 explicit ErrorStateImpl(ErrorStateClient* client, Logger* logger); 23 explicit ErrorStateImpl(ErrorStateClient* client, Logger* logger);
21 ~ErrorStateImpl() override; 24 ~ErrorStateImpl() override;
22 25
23 uint32 GetGLError() override; 26 uint32_t GetGLError() override;
24 27
25 void SetGLError(const char* filename, 28 void SetGLError(const char* filename,
26 int line, 29 int line,
27 unsigned int error, 30 unsigned int error,
28 const char* function_name, 31 const char* function_name,
29 const char* msg) override; 32 const char* msg) override;
30 void SetGLErrorInvalidEnum(const char* filename, 33 void SetGLErrorInvalidEnum(const char* filename,
31 int line, 34 int line,
32 const char* function_name, 35 const char* function_name,
33 unsigned int value, 36 unsigned int value,
(...skipping 22 matching lines...) Expand all
56 void ClearRealGLErrors(const char* filename, 59 void ClearRealGLErrors(const char* filename,
57 int line, 60 int line,
58 const char* function_name) override; 61 const char* function_name) override;
59 62
60 private: 63 private:
61 GLenum GetErrorHandleContextLoss(); 64 GLenum GetErrorHandleContextLoss();
62 65
63 // The last error message set. 66 // The last error message set.
64 std::string last_error_; 67 std::string last_error_;
65 // Current GL error bits. 68 // Current GL error bits.
66 uint32 error_bits_; 69 uint32_t error_bits_;
67 70
68 ErrorStateClient* client_; 71 ErrorStateClient* client_;
69 Logger* logger_; 72 Logger* logger_;
70 73
71 DISALLOW_COPY_AND_ASSIGN(ErrorStateImpl); 74 DISALLOW_COPY_AND_ASSIGN(ErrorStateImpl);
72 }; 75 };
73 76
74 ErrorState::ErrorState() {} 77 ErrorState::ErrorState() {}
75 78
76 ErrorState::~ErrorState() {} 79 ErrorState::~ErrorState() {}
77 80
78 ErrorState* ErrorState::Create(ErrorStateClient* client, Logger* logger) { 81 ErrorState* ErrorState::Create(ErrorStateClient* client, Logger* logger) {
79 return new ErrorStateImpl(client, logger); 82 return new ErrorStateImpl(client, logger);
80 } 83 }
81 84
82 ErrorStateImpl::ErrorStateImpl(ErrorStateClient* client, Logger* logger) 85 ErrorStateImpl::ErrorStateImpl(ErrorStateClient* client, Logger* logger)
83 : error_bits_(0), client_(client), logger_(logger) {} 86 : error_bits_(0), client_(client), logger_(logger) {}
84 87
85 ErrorStateImpl::~ErrorStateImpl() {} 88 ErrorStateImpl::~ErrorStateImpl() {}
86 89
87 uint32 ErrorStateImpl::GetGLError() { 90 uint32_t ErrorStateImpl::GetGLError() {
88 // Check the GL error first, then our wrapped error. 91 // Check the GL error first, then our wrapped error.
89 GLenum error = GetErrorHandleContextLoss(); 92 GLenum error = GetErrorHandleContextLoss();
90 if (error == GL_NO_ERROR && error_bits_ != 0) { 93 if (error == GL_NO_ERROR && error_bits_ != 0) {
91 for (uint32 mask = 1; mask != 0; mask = mask << 1) { 94 for (uint32_t mask = 1; mask != 0; mask = mask << 1) {
92 if ((error_bits_ & mask) != 0) { 95 if ((error_bits_ & mask) != 0) {
93 error = GLES2Util::GLErrorBitToGLError(mask); 96 error = GLES2Util::GLErrorBitToGLError(mask);
94 break; 97 break;
95 } 98 }
96 } 99 }
97 } 100 }
98 101
99 if (error != GL_NO_ERROR) { 102 if (error != GL_NO_ERROR) {
100 // There was an error, clear the corresponding wrapped error. 103 // There was an error, clear the corresponding wrapped error.
101 error_bits_ &= ~GLES2Util::GLErrorToErrorBit(error); 104 error_bits_ &= ~GLES2Util::GLErrorToErrorBit(error);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 GLES2Util::GetStringEnum(error) + " : " + 213 GLES2Util::GetStringEnum(error) + " : " +
211 function_name + ": was unhandled"); 214 function_name + ": was unhandled");
212 NOTREACHED() << "GL error " << error << " was unhandled."; 215 NOTREACHED() << "GL error " << error << " was unhandled.";
213 } 216 }
214 } 217 }
215 } 218 }
216 219
217 } // namespace gles2 220 } // namespace gles2
218 } // namespace gpu 221 } // namespace gpu
219 222
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/context_state_unittest.cc ('k') | gpu/command_buffer/service/error_state_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698