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

Unified 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: 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_surface_texture.cc
diff --git a/content/common/gpu/gpu_memory_buffer_factory_surface_texture.cc b/content/common/gpu/gpu_memory_buffer_factory_surface_texture.cc
index 1b2c881f6aeb2e5420e57cd9e5bf68eb4672e543..be755302b22b6f3c633485d92fc48532f047aca8 100644
--- a/content/common/gpu/gpu_memory_buffer_factory_surface_texture.cc
+++ b/content/common/gpu/gpu_memory_buffer_factory_surface_texture.cc
@@ -51,6 +51,7 @@ GpuMemoryBufferFactorySurfaceTexture::CreateGpuMemoryBuffer(
gfx::GpuMemoryBuffer::Usage usage,
int client_id,
gfx::PluginWindowHandle surface_handle) {
+ DCHECK(thread_checker_.CalledOnValidThread());
// Note: this needs to be 0 as the surface texture implemenation will take
// ownership of the texture and call glDeleteTextures when the GPU service
// attaches the surface texture to a real texture id. glDeleteTextures
@@ -64,13 +65,9 @@ GpuMemoryBufferFactorySurfaceTexture::CreateGpuMemoryBuffer(
SurfaceTextureManager::GetInstance()->RegisterSurfaceTexture(
id, client_id, surface_texture.get());
- {
- base::AutoLock lock(surface_textures_lock_);
-
- SurfaceTextureMapKey key(id, client_id);
- DCHECK(surface_textures_.find(key) == surface_textures_.end());
- surface_textures_[key] = surface_texture;
- }
+ SurfaceTextureMapKey key(id, client_id);
+ DCHECK(surface_textures_.find(key) == surface_textures_.end());
+ surface_textures_[key] = surface_texture;
gfx::GpuMemoryBufferHandle handle;
handle.type = gfx::SURFACE_TEXTURE_BUFFER;
@@ -81,14 +78,11 @@ GpuMemoryBufferFactorySurfaceTexture::CreateGpuMemoryBuffer(
void GpuMemoryBufferFactorySurfaceTexture::DestroyGpuMemoryBuffer(
gfx::GpuMemoryBufferId id,
int client_id) {
- {
- base::AutoLock lock(surface_textures_lock_);
-
- SurfaceTextureMapKey key(id, client_id);
- SurfaceTextureMap::iterator it = surface_textures_.find(key);
- if (it != surface_textures_.end())
- surface_textures_.erase(it);
- }
+ DCHECK(thread_checker_.CalledOnValidThread());
+ SurfaceTextureMapKey key(id, client_id);
+ SurfaceTextureMap::iterator it = surface_textures_.find(key);
+ if (it != surface_textures_.end())
+ surface_textures_.erase(it);
SurfaceTextureManager::GetInstance()->UnregisterSurfaceTexture(id, client_id);
}
@@ -104,8 +98,7 @@ GpuMemoryBufferFactorySurfaceTexture::CreateImageForGpuMemoryBuffer(
gfx::GpuMemoryBuffer::Format format,
unsigned internalformat,
int client_id) {
- base::AutoLock lock(surface_textures_lock_);
-
+ DCHECK(thread_checker_.CalledOnValidThread());
DCHECK_EQ(handle.type, gfx::SURFACE_TEXTURE_BUFFER);
SurfaceTextureMapKey key(handle.id, client_id);

Powered by Google App Engine
This is Rietveld 408576698