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

Unified Diff: content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.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_ozone_native_buffer.cc
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.cc b/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.cc
index 327a755b51c398e9e3726da70d316ccd3838b873..79bd0dd3eac93546ca0bc9d6750df50175734bfa 100644
--- a/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.cc
+++ b/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.cc
@@ -4,7 +4,6 @@
#include "content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.h"
-#include "base/atomic_sequence_num.h"
#include "base/bind.h"
#include "content/common/gpu/client/gpu_memory_buffer_factory_host.h"
#include "ui/gl/gl_bindings.h"
@@ -12,8 +11,6 @@
namespace content {
namespace {
-base::StaticAtomicSequenceNumber g_next_buffer_id;
-
void Noop() {
}
@@ -39,11 +36,11 @@ void GpuMemoryBufferCreatedForChildProcess(
} // namespace
GpuMemoryBufferImplOzoneNativeBuffer::GpuMemoryBufferImplOzoneNativeBuffer(
+ gfx::GpuMemoryBufferId id,
const gfx::Size& size,
Format format,
- const DestructionCallback& callback,
- const gfx::GpuMemoryBufferId& id)
- : GpuMemoryBufferImpl(size, format, callback), id_(id) {
+ const DestructionCallback& callback)
+ : GpuMemoryBufferImpl(id, size, format, callback) {
}
GpuMemoryBufferImplOzoneNativeBuffer::~GpuMemoryBufferImplOzoneNativeBuffer() {
@@ -51,37 +48,35 @@ GpuMemoryBufferImplOzoneNativeBuffer::~GpuMemoryBufferImplOzoneNativeBuffer() {
// static
void GpuMemoryBufferImplOzoneNativeBuffer::Create(
+ gfx::GpuMemoryBufferId id,
const gfx::Size& size,
Format format,
int client_id,
const CreationCallback& callback) {
- gfx::GpuMemoryBufferHandle handle;
- handle.global_id.primary_id = g_next_buffer_id.GetNext();
- handle.global_id.secondary_id = client_id;
- handle.type = gfx::OZONE_NATIVE_BUFFER;
GpuMemoryBufferFactoryHost::GetInstance()->CreateGpuMemoryBuffer(
- handle,
+ gfx::OZONE_NATIVE_BUFFER,
+ id,
size,
format,
SCANOUT,
+ client_id,
base::Bind(&GpuMemoryBufferCreated, size, format, callback));
}
// static
void GpuMemoryBufferImplOzoneNativeBuffer::AllocateForChildProcess(
+ gfx::GpuMemoryBufferId id,
const gfx::Size& size,
Format format,
int child_client_id,
const AllocationCallback& callback) {
- gfx::GpuMemoryBufferHandle handle;
- handle.global_id.primary_id = g_next_buffer_id.GetNext();
- handle.global_id.secondary_id = child_client_id;
- handle.type = gfx::OZONE_NATIVE_BUFFER;
GpuMemoryBufferFactoryHost::GetInstance()->CreateGpuMemoryBuffer(
- handle,
+ gfx::OZONE_NATIVE_BUFFER,
+ id,
size,
format,
SCANOUT,
+ child_client_id,
base::Bind(&GpuMemoryBufferCreatedForChildProcess, callback));
}
@@ -96,7 +91,7 @@ GpuMemoryBufferImplOzoneNativeBuffer::CreateFromHandle(
return make_scoped_ptr<GpuMemoryBufferImpl>(
new GpuMemoryBufferImplOzoneNativeBuffer(
- size, format, callback, handle.global_id));
+ handle.id, size, format, callback));
}
// static
@@ -151,7 +146,7 @@ gfx::GpuMemoryBufferHandle GpuMemoryBufferImplOzoneNativeBuffer::GetHandle()
const {
gfx::GpuMemoryBufferHandle handle;
handle.type = gfx::OZONE_NATIVE_BUFFER;
- handle.global_id = id_;
+ handle.id = id_;
return handle;
}

Powered by Google App Engine
This is Rietveld 408576698