Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Side by Side Diff: content/common/gpu/gpu_memory_buffer_factory_surface_texture.cc

Issue 1050923003: zero-copy: Clarify to allocate/destroy GpuMemoryBuffer on any thread and use it on the main thread o (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: just add thread check Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 98 }
99 99
100 scoped_refptr<gfx::GLImage> 100 scoped_refptr<gfx::GLImage>
101 GpuMemoryBufferFactorySurfaceTexture::CreateImageForGpuMemoryBuffer( 101 GpuMemoryBufferFactorySurfaceTexture::CreateImageForGpuMemoryBuffer(
102 const gfx::GpuMemoryBufferHandle& handle, 102 const gfx::GpuMemoryBufferHandle& handle,
103 const gfx::Size& size, 103 const gfx::Size& size,
104 gfx::GpuMemoryBuffer::Format format, 104 gfx::GpuMemoryBuffer::Format format,
105 unsigned internalformat, 105 unsigned internalformat,
106 int client_id) { 106 int client_id) {
107 base::AutoLock lock(surface_textures_lock_); 107 base::AutoLock lock(surface_textures_lock_);
108 108 DCHECK(thread_checker_.CalledOnValidThread());
reveman 2015/04/07 13:07:05 ditto
dshwang 2015/04/07 14:04:26 ditto
109 DCHECK_EQ(handle.type, gfx::SURFACE_TEXTURE_BUFFER); 109 DCHECK_EQ(handle.type, gfx::SURFACE_TEXTURE_BUFFER);
110 110
111 SurfaceTextureMapKey key(handle.id, client_id); 111 SurfaceTextureMapKey key(handle.id, client_id);
112 SurfaceTextureMap::iterator it = surface_textures_.find(key); 112 SurfaceTextureMap::iterator it = surface_textures_.find(key);
113 if (it == surface_textures_.end()) 113 if (it == surface_textures_.end())
114 return scoped_refptr<gfx::GLImage>(); 114 return scoped_refptr<gfx::GLImage>();
115 115
116 scoped_refptr<gfx::GLImageSurfaceTexture> image( 116 scoped_refptr<gfx::GLImageSurfaceTexture> image(
117 new gfx::GLImageSurfaceTexture(size)); 117 new gfx::GLImageSurfaceTexture(size));
118 if (!image->Initialize(it->second.get())) 118 if (!image->Initialize(it->second.get()))
119 return scoped_refptr<gfx::GLImage>(); 119 return scoped_refptr<gfx::GLImage>();
120 120
121 return image; 121 return image;
122 } 122 }
123 123
124 } // namespace content 124 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698