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

Unified Diff: ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_buffer.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 side-by-side diff with in-line comments
Download patch
Index: ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_buffer.cc
diff --git a/ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_buffer.cc b/ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_buffer.cc
index 38667e51e180f2d306fc50ec87e8994da9d88e1f..fe30e17ed0c09140f7d5b7798835631070f35311 100644
--- a/ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_buffer.cc
+++ b/ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_buffer.cc
@@ -166,7 +166,8 @@ GpuMemoryBufferFactoryOzoneNativeBuffer::CreateImageForGpuMemoryBuffer(
gfx::GpuMemoryBuffer::Format format,
unsigned internalformat,
int client_id) {
- NativePixmap* pixmap = nullptr;
+ DCHECK(thread_checker_.CalledOnValidThread());
reveman 2015/04/07 13:07:05 ditto
dshwang 2015/04/07 14:04:26 ditto
+ scoped_refptr<NativePixmap> pixmap(nullptr);
reveman 2015/04/07 13:07:05 what's wrong with the previous code?
dshwang 2015/04/07 14:04:26 nothing wrong. I'll roll back
{
base::AutoLock lock(native_pixmap_map_lock_);
BufferToPixmapMap::iterator it =
@@ -174,7 +175,7 @@ GpuMemoryBufferFactoryOzoneNativeBuffer::CreateImageForGpuMemoryBuffer(
if (it == native_pixmap_map_.end()) {
return scoped_refptr<gfx::GLImage>();
}
- pixmap = it->second.get();
+ pixmap.swap(it->second);
}
return CreateImageForPixmap(pixmap, size, format, internalformat);
}

Powered by Google App Engine
This is Rietveld 408576698