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

Side by Side Diff: cc/test/ordered_texture_map.cc

Issue 635543002: cc: Make ResourceProvider use bindless Produce/ConsumeTextureCHROMIUM (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase to ToT Created 5 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/test/ordered_texture_map.h" 5 #include "cc/test/ordered_texture_map.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "cc/test/test_texture.h" 8 #include "cc/test/test_texture.h"
9 9
10 namespace cc { 10 namespace cc {
(...skipping 14 matching lines...) Expand all
25 void OrderedTextureMap::Replace(GLuint id, 25 void OrderedTextureMap::Replace(GLuint id,
26 scoped_refptr<TestTexture> texture) { 26 scoped_refptr<TestTexture> texture) {
27 DCHECK(texture.get()); 27 DCHECK(texture.get());
28 DCHECK(ContainsId(id)); 28 DCHECK(ContainsId(id));
29 29
30 textures_[id] = texture; 30 textures_[id] = texture;
31 } 31 }
32 32
33 void OrderedTextureMap::Remove(GLuint id) { 33 void OrderedTextureMap::Remove(GLuint id) {
34 TextureMap::iterator map_it = textures_.find(id); 34 TextureMap::iterator map_it = textures_.find(id);
35 DCHECK(map_it != textures_.end()); 35 // for some test we generate dummy tex id, which are not registered,
36 // nothing to remove in that case.
sohanjg 2015/02/27 11:15:02 as we are returning dummy tex id from MOCK Createa
37 if (map_it == textures_.end())
38 return;
36 textures_.erase(map_it); 39 textures_.erase(map_it);
37 40
38 TextureList::iterator list_it = 41 TextureList::iterator list_it =
39 std::find(ordered_textures_.begin(), ordered_textures_.end(), id); 42 std::find(ordered_textures_.begin(), ordered_textures_.end(), id);
40 DCHECK(list_it != ordered_textures_.end()); 43 DCHECK(list_it != ordered_textures_.end());
41 ordered_textures_.erase(list_it); 44 ordered_textures_.erase(list_it);
42 } 45 }
43 46
44 size_t OrderedTextureMap::Size() { return ordered_textures_.size(); } 47 size_t OrderedTextureMap::Size() { return ordered_textures_.size(); }
45 48
46 bool OrderedTextureMap::ContainsId(GLuint id) { 49 bool OrderedTextureMap::ContainsId(GLuint id) {
47 return textures_.find(id) != textures_.end(); 50 return textures_.find(id) != textures_.end();
48 } 51 }
49 52
50 scoped_refptr<TestTexture> OrderedTextureMap::TextureForId(GLuint id) { 53 scoped_refptr<TestTexture> OrderedTextureMap::TextureForId(GLuint id) {
51 DCHECK(ContainsId(id)); 54 DCHECK(ContainsId(id));
52 scoped_refptr<TestTexture> texture = textures_[id]; 55 scoped_refptr<TestTexture> texture = textures_[id];
53 DCHECK(texture.get()); 56 DCHECK(texture.get());
54 return texture; 57 return texture;
55 } 58 }
56 59
57 GLuint OrderedTextureMap::IdAt(size_t index) { 60 GLuint OrderedTextureMap::IdAt(size_t index) {
58 DCHECK(index < Size()); 61 DCHECK(index < Size());
59 return ordered_textures_[index]; 62 return ordered_textures_[index];
60 } 63 }
61 64
62 } // namespace cc 65 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698