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

Side by Side Diff: content/common/gpu/gpu_memory_buffer_factory_io_surface.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_io_surface.h" 5 #include "content/common/gpu/gpu_memory_buffer_factory_io_surface.h"
6 6
7 #include <CoreFoundation/CoreFoundation.h> 7 #include <CoreFoundation/CoreFoundation.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/gl/gl_image_io_surface.h" 10 #include "ui/gl/gl_image_io_surface.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 152 }
153 153
154 scoped_refptr<gfx::GLImage> 154 scoped_refptr<gfx::GLImage>
155 GpuMemoryBufferFactoryIOSurface::CreateImageForGpuMemoryBuffer( 155 GpuMemoryBufferFactoryIOSurface::CreateImageForGpuMemoryBuffer(
156 const gfx::GpuMemoryBufferHandle& handle, 156 const gfx::GpuMemoryBufferHandle& handle,
157 const gfx::Size& size, 157 const gfx::Size& size,
158 gfx::GpuMemoryBuffer::Format format, 158 gfx::GpuMemoryBuffer::Format format,
159 unsigned internalformat, 159 unsigned internalformat,
160 int client_id) { 160 int client_id) {
161 base::AutoLock lock(io_surfaces_lock_); 161 base::AutoLock lock(io_surfaces_lock_);
162 162 DCHECK(thread_checker_.CalledOnValidThread());
reveman 2015/04/07 13:07:05 I don't think we want a thread checker here as tha
dshwang 2015/04/07 14:04:26 We allow CreateGpuMemoryBuffer() to be called on a
reveman 2015/04/07 14:22:00 Sorry I misread this change. Yes, image creation
163 DCHECK_EQ(handle.type, gfx::IO_SURFACE_BUFFER); 163 DCHECK_EQ(handle.type, gfx::IO_SURFACE_BUFFER);
164 IOSurfaceMapKey key(handle.id, client_id); 164 IOSurfaceMapKey key(handle.id, client_id);
165 IOSurfaceMap::iterator it = io_surfaces_.find(key); 165 IOSurfaceMap::iterator it = io_surfaces_.find(key);
166 if (it == io_surfaces_.end()) 166 if (it == io_surfaces_.end())
167 return scoped_refptr<gfx::GLImage>(); 167 return scoped_refptr<gfx::GLImage>();
168 168
169 scoped_refptr<gfx::GLImageIOSurface> image(new gfx::GLImageIOSurface(size)); 169 scoped_refptr<gfx::GLImageIOSurface> image(new gfx::GLImageIOSurface(size));
170 if (!image->Initialize(it->second.get())) 170 if (!image->Initialize(it->second.get()))
171 return scoped_refptr<gfx::GLImage>(); 171 return scoped_refptr<gfx::GLImage>();
172 172
173 return image; 173 return image;
174 } 174 }
175 175
176 } // namespace content 176 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698