| 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 11 matching lines...) Expand all Loading... |
| 22 const gfx::Size& size, | 22 const gfx::Size& size, |
| 23 gfx::BufferFormat format, | 23 gfx::BufferFormat format, |
| 24 gfx::BufferUsage usage, | 24 gfx::BufferUsage usage, |
| 25 int client_id, | 25 int client_id, |
| 26 SurfaceHandle surface_handle) { | 26 SurfaceHandle surface_handle) { |
| 27 // Note: this needs to be 0 as the surface texture implemenation will take | 27 // Note: this needs to be 0 as the surface texture implemenation will take |
| 28 // ownership of the texture and call glDeleteTextures when the GPU service | 28 // ownership of the texture and call glDeleteTextures when the GPU service |
| 29 // attaches the surface texture to a real texture id. glDeleteTextures | 29 // attaches the surface texture to a real texture id. glDeleteTextures |
| 30 // silently ignores 0. | 30 // silently ignores 0. |
| 31 const int kDummyTextureId = 0; | 31 const int kDummyTextureId = 0; |
| 32 scoped_refptr<gfx::SurfaceTexture> surface_texture = | 32 scoped_refptr<gl::SurfaceTexture> surface_texture = |
| 33 gfx::SurfaceTexture::Create(kDummyTextureId); | 33 gl::SurfaceTexture::Create(kDummyTextureId); |
| 34 if (!surface_texture.get()) | 34 if (!surface_texture.get()) |
| 35 return gfx::GpuMemoryBufferHandle(); | 35 return gfx::GpuMemoryBufferHandle(); |
| 36 | 36 |
| 37 SurfaceTextureManager::GetInstance()->RegisterSurfaceTexture( | 37 SurfaceTextureManager::GetInstance()->RegisterSurfaceTexture( |
| 38 id.id, client_id, surface_texture.get()); | 38 id.id, client_id, surface_texture.get()); |
| 39 | 39 |
| 40 { | 40 { |
| 41 base::AutoLock lock(surface_textures_lock_); | 41 base::AutoLock lock(surface_textures_lock_); |
| 42 | 42 |
| 43 SurfaceTextureMapKey key(id.id, client_id); | 43 SurfaceTextureMapKey key(id.id, client_id); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 scoped_refptr<gl::GLImageSurfaceTexture> image( | 100 scoped_refptr<gl::GLImageSurfaceTexture> image( |
| 101 new gl::GLImageSurfaceTexture(size)); | 101 new gl::GLImageSurfaceTexture(size)); |
| 102 if (!image->Initialize(it->second.get())) | 102 if (!image->Initialize(it->second.get())) |
| 103 return scoped_refptr<gl::GLImage>(); | 103 return scoped_refptr<gl::GLImage>(); |
| 104 | 104 |
| 105 return image; | 105 return image; |
| 106 } | 106 } |
| 107 | 107 |
| 108 } // namespace gpu | 108 } // namespace gpu |
| OLD | NEW |