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

Side by Side Diff: gpu/command_buffer/common/id_allocator.cc

Issue 2865003: Working towards -Wextra... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/pepper_plugin_delegate_impl.h ('k') | net/base/cookie_monster.cc » ('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) 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 // This file contains the implementation of IdAllocator. 5 // This file contains the implementation of IdAllocator.
6 6
7 #include "../common/id_allocator.h" 7 #include "../common/id_allocator.h"
8 #include "../common/logging.h" 8 #include "../common/logging.h"
9 9
10 namespace gpu { 10 namespace gpu {
11 11
12 IdAllocator::IdAllocator() { 12 IdAllocator::IdAllocator() {
13 } 13 }
14 14
15 ResourceId IdAllocator::FindFirstFree() const { 15 ResourceId IdAllocator::FindFirstFree() const {
16 ResourceId id = 1; 16 ResourceId id = 1;
17 for (ResourceIdSet::const_iterator it = used_ids_.begin(); 17 for (ResourceIdSet::const_iterator it = used_ids_.begin();
18 it != used_ids_.end(); ++it) { 18 it != used_ids_.end(); ++it) {
19 if ((*it) != id) { 19 if ((*it) != id) {
20 return id; 20 return id;
21 } 21 }
22 ++id; 22 ++id;
23 } 23 }
24 return id; 24 return id;
25 } 25 }
26 26
27 ResourceId IdAllocator::AllocateIDAtOrAbove(ResourceId desired_id) { 27 ResourceId IdAllocator::AllocateIDAtOrAbove(ResourceId desired_id) {
28 DCHECK_LT(static_cast<ResourceId>(used_ids_.size()), 28 DCHECK_LT(static_cast<ResourceId>(used_ids_.size()),
29 static_cast<ResourceId>(-1)); 29 static_cast<ResourceId>(-1));
30 for (; InUse(desired_id); ++desired_id); 30 for (; InUse(desired_id); ++desired_id) {}
31 MarkAsUsed(desired_id); 31 MarkAsUsed(desired_id);
32 return desired_id; 32 return desired_id;
33 } 33 }
34 34
35 } // namespace gpu 35 } // namespace gpu
OLDNEW
« no previous file with comments | « chrome/renderer/pepper_plugin_delegate_impl.h ('k') | net/base/cookie_monster.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698