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

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

Issue 2043983002: gpu: Disallow null client ids in Gen* functions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 manager->GetClientId(object->service_id(), &client_id); 186 manager->GetClientId(object->service_id(), &client_id);
187 } 187 }
188 return client_id; 188 return client_id;
189 } 189 }
190 190
191 template <typename OBJECT_TYPE> 191 template <typename OBJECT_TYPE>
192 GLuint GetServiceId(const OBJECT_TYPE* object) { 192 GLuint GetServiceId(const OBJECT_TYPE* object) {
193 return object ? object->service_id() : 0; 193 return object ? object->service_id() : 0;
194 } 194 }
195 195
196 bool CheckUniqueIds(GLsizei n, const GLuint* client_ids) { 196 bool CheckUniqueAndNonNullIds(GLsizei n, const GLuint* client_ids) {
197 if (n <= 0) 197 if (n <= 0)
198 return true; 198 return true;
199 std::unordered_set<uint32_t> unique_ids(client_ids, client_ids + n); 199 std::unordered_set<uint32_t> unique_ids(client_ids, client_ids + n);
200 return unique_ids.size() == static_cast<size_t>(n); 200 return (unique_ids.size() == static_cast<size_t>(n)) &&
201 (unique_ids.find(0) == unique_ids.end());
201 } 202 }
202 203
203 struct Vec4f { 204 struct Vec4f {
204 explicit Vec4f(const Vec4& data) { 205 explicit Vec4f(const Vec4& data) {
205 data.GetValues(v); 206 data.GetValues(v);
206 } 207 }
207 208
208 GLfloat v[4]; 209 GLfloat v[4];
209 }; 210 };
210 211
(...skipping 16579 matching lines...) Expand 10 before | Expand all | Expand 10 after
16790 } 16791 }
16791 16792
16792 // Include the auto-generated part of this file. We split this because it means 16793 // Include the auto-generated part of this file. We split this because it means
16793 // we can easily edit the non-auto generated parts right here in this file 16794 // we can easily edit the non-auto generated parts right here in this file
16794 // instead of having to edit some template or the code generator. 16795 // instead of having to edit some template or the code generator.
16795 #include "base/macros.h" 16796 #include "base/macros.h"
16796 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 16797 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
16797 16798
16798 } // namespace gles2 16799 } // namespace gles2
16799 } // namespace gpu 16800 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/build_gles2_cmd_buffer.py ('k') | gpu/command_buffer/service/gles2_cmd_decoder_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698