ordered_texture_map.h revision 0f1bc08d4cfcc34181b0b5cbf065c40f687bf740
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 3// found in the LICENSE file. 4 5#ifndef CC_TEST_ORDERED_TEXTURE_MAP_H_ 6#define CC_TEST_ORDERED_TEXTURE_MAP_H_ 7 8#include <vector> 9 10#include "base/containers/hash_tables.h" 11#include "base/memory/ref_counted.h" 12#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" 13 14namespace cc { 15 16struct TestTexture; 17 18class OrderedTextureMap { 19 public: 20 OrderedTextureMap(); 21 ~OrderedTextureMap(); 22 23 void Append(WebKit::WebGLId id, scoped_refptr<TestTexture> texture); 24 void Replace(WebKit::WebGLId id, scoped_refptr<TestTexture> texture); 25 void Remove(WebKit::WebGLId id); 26 27 size_t Size(); 28 29 bool ContainsId(WebKit::WebGLId id); 30 31 scoped_refptr<TestTexture> TextureForId(WebKit::WebGLId id); 32 WebKit::WebGLId IdAt(size_t index); 33 34 private: 35 typedef base::hash_map<WebKit::WebGLId, scoped_refptr<TestTexture> > 36 TextureMap; 37 typedef std::vector<WebKit::WebGLId> TextureList; 38 39 TextureMap textures_; 40 TextureList ordered_textures_; 41}; 42 43} // namespace cc 44 45#endif // CC_TEST_ORDERED_TEXTURE_MAP_H_ 46