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

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

Issue 685983005: gpu: Associate all GpuMemoryBuffers with unique IDs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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/client/gpu_memory_buffer_impl_io_surface.cc
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc b/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc
index e8598c665dd77ada82103323cfd36c353d85dae2..44f149cf397d4231fc64b5aa302e517a1b7f8bc5 100644
--- a/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc
+++ b/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc
@@ -4,7 +4,6 @@
#include "content/common/gpu/client/gpu_memory_buffer_impl_io_surface.h"
-#include "base/atomic_sequence_num.h"
#include "base/bind.h"
#include "base/logging.h"
#include "content/common/gpu/client/gpu_memory_buffer_factory_host.h"
@@ -13,8 +12,6 @@
namespace content {
namespace {
-base::StaticAtomicSequenceNumber g_next_buffer_id;
-
void Noop() {
}
@@ -40,48 +37,47 @@ void GpuMemoryBufferCreatedForChildProcess(
} // namespace
GpuMemoryBufferImplIOSurface::GpuMemoryBufferImplIOSurface(
+ gfx::GpuMemoryBufferId id,
const gfx::Size& size,
Format format,
const DestructionCallback& callback,
IOSurfaceRef io_surface)
- : GpuMemoryBufferImpl(size, format, callback), io_surface_(io_surface) {
+ : GpuMemoryBufferImpl(id, size, format, callback), io_surface_(io_surface) {
}
GpuMemoryBufferImplIOSurface::~GpuMemoryBufferImplIOSurface() {
}
// static
-void GpuMemoryBufferImplIOSurface::Create(const gfx::Size& size,
+void GpuMemoryBufferImplIOSurface::Create(gfx::GpuMemoryBufferId id,
+ const gfx::Size& size,
Format format,
int client_id,
const CreationCallback& callback) {
- gfx::GpuMemoryBufferHandle handle;
- handle.type = gfx::IO_SURFACE_BUFFER;
- handle.global_id.primary_id = g_next_buffer_id.GetNext();
- handle.global_id.secondary_id = client_id;
GpuMemoryBufferFactoryHost::GetInstance()->CreateGpuMemoryBuffer(
- handle,
+ gfx::IO_SURFACE_BUFFER,
+ id,
size,
format,
MAP,
+ client_id,
base::Bind(&GpuMemoryBufferCreated, size, format, callback));
}
// static
void GpuMemoryBufferImplIOSurface::AllocateForChildProcess(
+ gfx::GpuMemoryBufferId id,
const gfx::Size& size,
Format format,
int child_client_id,
const AllocationCallback& callback) {
- gfx::GpuMemoryBufferHandle handle;
- handle.type = gfx::IO_SURFACE_BUFFER;
- handle.global_id.primary_id = g_next_buffer_id.GetNext();
- handle.global_id.secondary_id = child_client_id;
GpuMemoryBufferFactoryHost::GetInstance()->CreateGpuMemoryBuffer(
- handle,
+ gfx::IO_SURFACE_BUFFER,
+ id,
size,
format,
MAP,
+ child_client_id,
base::Bind(&GpuMemoryBufferCreatedForChildProcess, callback));
}
@@ -99,7 +95,7 @@ scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImplIOSurface::CreateFromHandle(
return scoped_ptr<GpuMemoryBufferImpl>();
return make_scoped_ptr<GpuMemoryBufferImpl>(new GpuMemoryBufferImplIOSurface(
- size, format, callback, io_surface.get()));
+ handle.id, size, format, callback, io_surface.get()));
}
// static
@@ -170,6 +166,7 @@ uint32 GpuMemoryBufferImplIOSurface::GetStride() const {
gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const {
gfx::GpuMemoryBufferHandle handle;
handle.type = gfx::IO_SURFACE_BUFFER;
+ handle.id = id_;
handle.io_surface_id = IOSurfaceGetID(io_surface_);
return handle;
}

Powered by Google App Engine
This is Rietveld 408576698