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

Unified 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: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/gpu_memory_buffer_factory_io_surface.cc
diff --git a/content/common/gpu/gpu_memory_buffer_factory_io_surface.cc b/content/common/gpu/gpu_memory_buffer_factory_io_surface.cc
index 604c1b4927388f956c415939b023ce24b242932c..b6135497b5a56bf168efe1bbfd1ecf7628bcb314 100644
--- a/content/common/gpu/gpu_memory_buffer_factory_io_surface.cc
+++ b/content/common/gpu/gpu_memory_buffer_factory_io_surface.cc
@@ -104,6 +104,7 @@ GpuMemoryBufferFactoryIOSurface::CreateGpuMemoryBuffer(
gfx::GpuMemoryBuffer::Usage usage,
int client_id,
gfx::PluginWindowHandle surface_handle) {
+ DCHECK(thread_checker_.CalledOnValidThread());
base::ScopedCFTypeRef<CFMutableDictionaryRef> properties;
properties.reset(CFDictionaryCreateMutable(kCFAllocatorDefault,
0,
@@ -121,13 +122,9 @@ GpuMemoryBufferFactoryIOSurface::CreateGpuMemoryBuffer(
if (!io_surface)
return gfx::GpuMemoryBufferHandle();
- {
- base::AutoLock lock(io_surfaces_lock_);
-
- IOSurfaceMapKey key(id, client_id);
- DCHECK(io_surfaces_.find(key) == io_surfaces_.end());
- io_surfaces_[key] = io_surface;
- }
+ IOSurfaceMapKey key(id, client_id);
+ DCHECK(io_surfaces_.find(key) == io_surfaces_.end());
+ io_surfaces_[key] = io_surface;
gfx::GpuMemoryBufferHandle handle;
handle.type = gfx::IO_SURFACE_BUFFER;
@@ -139,8 +136,7 @@ GpuMemoryBufferFactoryIOSurface::CreateGpuMemoryBuffer(
void GpuMemoryBufferFactoryIOSurface::DestroyGpuMemoryBuffer(
gfx::GpuMemoryBufferId id,
int client_id) {
- base::AutoLock lock(io_surfaces_lock_);
-
+ DCHECK(thread_checker_.CalledOnValidThread());
IOSurfaceMapKey key(id, client_id);
IOSurfaceMap::iterator it = io_surfaces_.find(key);
if (it != io_surfaces_.end())
@@ -158,8 +154,7 @@ GpuMemoryBufferFactoryIOSurface::CreateImageForGpuMemoryBuffer(
gfx::GpuMemoryBuffer::Format format,
unsigned internalformat,
int client_id) {
- base::AutoLock lock(io_surfaces_lock_);
-
+ DCHECK(thread_checker_.CalledOnValidThread());
DCHECK_EQ(handle.type, gfx::IO_SURFACE_BUFFER);
IOSurfaceMapKey key(handle.id, client_id);
IOSurfaceMap::iterator it = io_surfaces_.find(key);

Powered by Google App Engine
This is Rietveld 408576698