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

Side by Side Diff: gpu/command_buffer/client/share_group.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
« no previous file with comments | « gpu/command_buffer/client/share_group.h ('k') | gpu/command_buffer/client/transfer_buffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/client/share_group.h" 5 #include "gpu/command_buffer/client/share_group.h"
6 6
7 #include <stdint.h>
8
7 #include <stack> 9 #include <stack>
8 #include <vector> 10 #include <vector>
9 #include "base/basictypes.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
12 #include "gpu/command_buffer/client/gles2_cmd_helper.h" 13 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
13 #include "gpu/command_buffer/client/gles2_implementation.h" 14 #include "gpu/command_buffer/client/gles2_implementation.h"
14 #include "gpu/command_buffer/client/program_info_manager.h" 15 #include "gpu/command_buffer/client/program_info_manager.h"
15 #include "gpu/command_buffer/common/id_allocator.h" 16 #include "gpu/command_buffer/common/id_allocator.h"
16 17
17 namespace gpu { 18 namespace gpu {
18 namespace gles2 { 19 namespace gles2 {
19 20
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 // Overridden from IdHandlerInterface. 228 // Overridden from IdHandlerInterface.
228 void FreeContext(GLES2Implementation* gl_impl) override { 229 void FreeContext(GLES2Implementation* gl_impl) override {
229 base::AutoLock auto_lock(lock_); 230 base::AutoLock auto_lock(lock_);
230 CollectPendingFreeIds(gl_impl); 231 CollectPendingFreeIds(gl_impl);
231 } 232 }
232 233
233 private: 234 private:
234 enum IdState { kIdFree, kIdPendingFree, kIdInUse }; 235 enum IdState { kIdFree, kIdPendingFree, kIdInUse };
235 236
236 void CollectPendingFreeIds(GLES2Implementation* gl_impl) { 237 void CollectPendingFreeIds(GLES2Implementation* gl_impl) {
237 uint32 flush_generation = gl_impl->helper()->flush_generation(); 238 uint32_t flush_generation = gl_impl->helper()->flush_generation();
238 ShareGroupContextData::IdHandlerData* ctxt_data = 239 ShareGroupContextData::IdHandlerData* ctxt_data =
239 gl_impl->share_group_context_data()->id_handler_data(id_namespace_); 240 gl_impl->share_group_context_data()->id_handler_data(id_namespace_);
240 241
241 if (ctxt_data->flush_generation_ != flush_generation) { 242 if (ctxt_data->flush_generation_ != flush_generation) {
242 ctxt_data->flush_generation_ = flush_generation; 243 ctxt_data->flush_generation_ = flush_generation;
243 for (uint32 ii = 0; ii < ctxt_data->freed_ids_.size(); ++ii) { 244 for (uint32_t ii = 0; ii < ctxt_data->freed_ids_.size(); ++ii) {
244 const GLuint id = ctxt_data->freed_ids_[ii]; 245 const GLuint id = ctxt_data->freed_ids_[ii];
245 DCHECK(id_states_[id - 1] == kIdPendingFree); 246 DCHECK(id_states_[id - 1] == kIdPendingFree);
246 id_states_[id - 1] = kIdFree; 247 id_states_[id - 1] = kIdFree;
247 free_ids_.push(id); 248 free_ids_.push(id);
248 } 249 }
249 ctxt_data->freed_ids_.clear(); 250 ctxt_data->freed_ids_.clear();
250 } 251 }
251 } 252 }
252 253
253 int id_namespace_; 254 int id_namespace_;
254 255
255 base::Lock lock_; 256 base::Lock lock_;
256 std::vector<uint8> id_states_; 257 std::vector<uint8_t> id_states_;
257 std::stack<uint32> free_ids_; 258 std::stack<uint32_t> free_ids_;
258 }; 259 };
259 260
260 // An id handler for ids that are never reused. 261 // An id handler for ids that are never reused.
261 class NonReusedIdHandler : public IdHandlerInterface { 262 class NonReusedIdHandler : public IdHandlerInterface {
262 public: 263 public:
263 NonReusedIdHandler() : last_id_(0) {} 264 NonReusedIdHandler() : last_id_(0) {}
264 ~NonReusedIdHandler() override {} 265 ~NonReusedIdHandler() override {}
265 266
266 // Overridden from IdHandlerInterface. 267 // Overridden from IdHandlerInterface.
267 void MakeIds(GLES2Implementation* /* gl_impl */, 268 void MakeIds(GLES2Implementation* /* gl_impl */,
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 } 375 }
375 376
376 void ShareGroup::set_program_info_manager(ProgramInfoManager* manager) { 377 void ShareGroup::set_program_info_manager(ProgramInfoManager* manager) {
377 program_info_manager_.reset(manager); 378 program_info_manager_.reset(manager);
378 } 379 }
379 380
380 ShareGroup::~ShareGroup() {} 381 ShareGroup::~ShareGroup() {}
381 382
382 } // namespace gles2 383 } // namespace gles2
383 } // namespace gpu 384 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/share_group.h ('k') | gpu/command_buffer/client/transfer_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698