| 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 "gpu/ipc/service/gpu_memory_buffer_factory_surface_texture.h" | 5 #include "gpu/ipc/service/gpu_memory_buffer_factory_surface_texture.h" |
| 6 | 6 |
| 7 #include "gpu/ipc/common/android/surface_texture_manager.h" | 7 #include "gpu/ipc/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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 ImageFactory* GpuMemoryBufferFactorySurfaceTexture::AsImageFactory() { | 69 ImageFactory* GpuMemoryBufferFactorySurfaceTexture::AsImageFactory() { |
| 70 return this; | 70 return this; |
| 71 } | 71 } |
| 72 | 72 |
| 73 scoped_refptr<gl::GLImage> | 73 scoped_refptr<gl::GLImage> |
| 74 GpuMemoryBufferFactorySurfaceTexture::CreateImageForGpuMemoryBuffer( | 74 GpuMemoryBufferFactorySurfaceTexture::CreateImageForGpuMemoryBuffer( |
| 75 const gfx::GpuMemoryBufferHandle& handle, | 75 const gfx::GpuMemoryBufferHandle& handle, |
| 76 const gfx::Size& size, | 76 const gfx::Size& size, |
| 77 gfx::BufferFormat format, | 77 gfx::BufferFormat format, |
| 78 unsigned internalformat, | 78 unsigned internalformat, |
| 79 int client_id) { | 79 int client_id, |
| 80 SurfaceHandle surface_handle) { |
| 80 base::AutoLock lock(surface_textures_lock_); | 81 base::AutoLock lock(surface_textures_lock_); |
| 81 | 82 |
| 82 DCHECK_EQ(handle.type, gfx::SURFACE_TEXTURE_BUFFER); | 83 DCHECK_EQ(handle.type, gfx::SURFACE_TEXTURE_BUFFER); |
| 83 | 84 |
| 84 SurfaceTextureMapKey key(handle.id.id, client_id); | 85 SurfaceTextureMapKey key(handle.id.id, client_id); |
| 85 SurfaceTextureMap::iterator it = surface_textures_.find(key); | 86 SurfaceTextureMap::iterator it = surface_textures_.find(key); |
| 86 if (it == surface_textures_.end()) | 87 if (it == surface_textures_.end()) |
| 87 return scoped_refptr<gl::GLImage>(); | 88 return scoped_refptr<gl::GLImage>(); |
| 88 | 89 |
| 89 scoped_refptr<gl::GLImageSurfaceTexture> image( | 90 scoped_refptr<gl::GLImageSurfaceTexture> image( |
| 90 new gl::GLImageSurfaceTexture(size)); | 91 new gl::GLImageSurfaceTexture(size)); |
| 91 if (!image->Initialize(it->second.get())) | 92 if (!image->Initialize(it->second.get())) |
| 92 return scoped_refptr<gl::GLImage>(); | 93 return scoped_refptr<gl::GLImage>(); |
| 93 | 94 |
| 94 return image; | 95 return image; |
| 95 } | 96 } |
| 96 | 97 |
| 97 } // namespace gpu | 98 } // namespace gpu |
| OLD | NEW |