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 3 // found in the LICENSE file. 4 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_IMAGE_MANAGER_H_ 6 #define GPU_COMMAND_BUFFER_SERVICE_IMAGE_MANAGER_H_ 7 8 #include "base/basictypes.h" 9 #include "base/containers/hash_tables.h" 10 #include "base/memory/ref_counted.h" 11 #include "gpu/gpu_export.h" 12 13 namespace gfx { 14 class GLImage; 15 } 16 17 namespace gpu { 18 namespace gles2 { 19 20 // Interface used by the cmd decoder to lookup images. 21 class GPU_EXPORT ImageManager : public base::RefCounted<ImageManager> { 22 public: 23 ImageManager(); 24 25 void AddImage(gfx::GLImage* gl_image, int32 service_id); 26 void RemoveImage(int32 service_id); 27 gfx::GLImage* LookupImage(int32 service_id); 28 29 private: 30 friend class base::RefCounted<ImageManager>; 31 32 ~ImageManager(); 33 34 typedef base::hash_map<uint32, scoped_refptr<gfx::GLImage> > GLImageMap; 35 GLImageMap gl_images_; 36 37 DISALLOW_COPY_AND_ASSIGN(ImageManager); 38 }; 39 40 } // namespage gles2 41 } // namespace gpu 42 43 #endif // GPU_COMMAND_BUFFER_SERVICE_IMAGE_MANAGER_H_ 44