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

Unified Diff: content/common/gpu/client/command_buffer_proxy_impl.cc

Issue 331723003: gpu: Remove Create/DeleteImage IPC by adding an X11_PIXMAP_BUFFER GpuMemoryBuffer type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 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
« no previous file with comments | « content/common/gpu/client/command_buffer_proxy_impl.h ('k') | content/common/gpu/client/gpu_channel_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/client/command_buffer_proxy_impl.cc
diff --git a/content/common/gpu/client/command_buffer_proxy_impl.cc b/content/common/gpu/client/command_buffer_proxy_impl.cc
index 7b7961f500923be427d8929ead36cd6b4d34f6a7..589fa17c771594e88fa4b32ba177d887ba2ca8a8 100644
--- a/content/common/gpu/client/command_buffer_proxy_impl.cc
+++ b/content/common/gpu/client/command_buffer_proxy_impl.cc
@@ -307,24 +307,21 @@ gfx::GpuMemoryBuffer* CommandBufferProxyImpl::CreateGpuMemoryBuffer(
if (last_state_.error != gpu::error::kNoError)
return NULL;
- int32 new_id = channel_->ReserveGpuMemoryBufferId();
- DCHECK(gpu_memory_buffers_.find(new_id) == gpu_memory_buffers_.end());
-
- scoped_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer(
+ scoped_ptr<gfx::GpuMemoryBuffer> buffer(
channel_->factory()->AllocateGpuMemoryBuffer(
width, height, internalformat, usage));
- if (!gpu_memory_buffer)
+ if (!buffer)
return NULL;
- DCHECK(GpuChannelHost::IsValidGpuMemoryBuffer(
- gpu_memory_buffer->GetHandle()));
+ DCHECK(GpuChannelHost::IsValidGpuMemoryBuffer(buffer->GetHandle()));
+
+ int32 new_id = channel_->ReserveGpuMemoryBufferId();
// This handle is owned by the GPU process and must be passed to it or it
// will leak. In otherwords, do not early out on error between here and the
// sending of the RegisterGpuMemoryBuffer IPC below.
gfx::GpuMemoryBufferHandle handle =
- channel_->ShareGpuMemoryBufferToGpuProcess(
- gpu_memory_buffer->GetHandle());
+ channel_->ShareGpuMemoryBufferToGpuProcess(buffer->GetHandle());
if (!Send(new GpuCommandBufferMsg_RegisterGpuMemoryBuffer(
route_id_,
@@ -337,22 +334,18 @@ gfx::GpuMemoryBuffer* CommandBufferProxyImpl::CreateGpuMemoryBuffer(
}
*id = new_id;
- gpu_memory_buffers_[new_id] = gpu_memory_buffer.release();
- return gpu_memory_buffers_[new_id];
+ DCHECK(gpu_memory_buffers_.find(new_id) == gpu_memory_buffers_.end());
+ return gpu_memory_buffers_.add(new_id, buffer.Pass()).first->second;
}
void CommandBufferProxyImpl::DestroyGpuMemoryBuffer(int32 id) {
if (last_state_.error != gpu::error::kNoError)
return;
- // Remove the gpu memory buffer from the client side cache.
- GpuMemoryBufferMap::iterator it = gpu_memory_buffers_.find(id);
- if (it != gpu_memory_buffers_.end()) {
- delete it->second;
- gpu_memory_buffers_.erase(it);
- }
-
Send(new GpuCommandBufferMsg_DestroyGpuMemoryBuffer(route_id_, id));
+
+ // Remove the gpu memory buffer from the client side cache.
+ gpu_memory_buffers_.erase(id);
}
int CommandBufferProxyImpl::GetRouteID() const {
« no previous file with comments | « content/common/gpu/client/command_buffer_proxy_impl.h ('k') | content/common/gpu/client/gpu_channel_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698