OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/common/gpu/gpu_memory_buffer_factory_surface_texture.h" | 5 #include "content/common/gpu/gpu_memory_buffer_factory_surface_texture.h" |
6 | 6 |
7 #include "content/common/android/surface_texture_manager.h" | 7 #include "content/common/android/surface_texture_manager.h" |
8 #include "ui/gl/android/surface_texture.h" | 8 #include "ui/gl/android/surface_texture.h" |
9 #include "ui/gl/gl_image_surface_texture.h" | 9 #include "ui/gl/gl_image_surface_texture.h" |
10 | 10 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 return handle; | 78 return handle; |
79 } | 79 } |
80 | 80 |
81 void GpuMemoryBufferFactorySurfaceTexture::DestroyGpuMemoryBuffer( | 81 void GpuMemoryBufferFactorySurfaceTexture::DestroyGpuMemoryBuffer( |
82 gfx::GpuMemoryBufferId id, | 82 gfx::GpuMemoryBufferId id, |
83 int client_id) { | 83 int client_id) { |
84 { | 84 { |
85 base::AutoLock lock(surface_textures_lock_); | 85 base::AutoLock lock(surface_textures_lock_); |
86 | 86 |
87 SurfaceTextureMapKey key(id, client_id); | 87 SurfaceTextureMapKey key(id, client_id); |
88 SurfaceTextureMap::iterator it = surface_textures_.find(key); | 88 DCHECK(surface_textures_.find(key) != surface_textures_.end()); |
89 if (it != surface_textures_.end()) | 89 surface_textures_.erase(key); |
90 surface_textures_.erase(it); | |
91 } | 90 } |
92 | 91 |
93 SurfaceTextureManager::GetInstance()->UnregisterSurfaceTexture(id, client_id); | 92 SurfaceTextureManager::GetInstance()->UnregisterSurfaceTexture(id, client_id); |
94 } | 93 } |
95 | 94 |
96 gpu::ImageFactory* GpuMemoryBufferFactorySurfaceTexture::AsImageFactory() { | 95 gpu::ImageFactory* GpuMemoryBufferFactorySurfaceTexture::AsImageFactory() { |
97 return this; | 96 return this; |
98 } | 97 } |
99 | 98 |
100 scoped_refptr<gfx::GLImage> | 99 scoped_refptr<gfx::GLImage> |
(...skipping 14 matching lines...) Expand all Loading... |
115 | 114 |
116 scoped_refptr<gfx::GLImageSurfaceTexture> image( | 115 scoped_refptr<gfx::GLImageSurfaceTexture> image( |
117 new gfx::GLImageSurfaceTexture(size)); | 116 new gfx::GLImageSurfaceTexture(size)); |
118 if (!image->Initialize(it->second.get())) | 117 if (!image->Initialize(it->second.get())) |
119 return scoped_refptr<gfx::GLImage>(); | 118 return scoped_refptr<gfx::GLImage>(); |
120 | 119 |
121 return image; | 120 return image; |
122 } | 121 } |
123 | 122 |
124 } // namespace content | 123 } // namespace content |
OLD | NEW |