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

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: one more ozone build fix 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 35e08c99308b44bfab62fb0e1473945eceaca92e..1706a01e136e37bace246253695f3db0479e57e7 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,23 +11,26 @@
namespace content {
namespace {
-base::StaticAtomicSequenceNumber g_next_buffer_id;
-
-void GpuMemoryBufferDeleted(const gfx::GpuMemoryBufferHandle& handle,
+void GpuMemoryBufferDeleted(gfx::GpuMemoryBufferId id,
+ int client_id,
uint32 sync_point) {
- GpuMemoryBufferFactoryHost::GetInstance()->DestroyGpuMemoryBuffer(handle,
- sync_point);
+ GpuMemoryBufferFactoryHost::GetInstance()->DestroyGpuMemoryBuffer(
+ gfx::OZONE_NATIVE_BUFFER, id, client_id, sync_point);
}
void GpuMemoryBufferCreated(
const gfx::Size& size,
gfx::GpuMemoryBuffer::Format format,
+ int client_id,
const GpuMemoryBufferImpl::CreationCallback& callback,
const gfx::GpuMemoryBufferHandle& handle) {
DCHECK_EQ(gfx::OZONE_NATIVE_BUFFER, handle.type);
callback.Run(GpuMemoryBufferImplOzoneNativeBuffer::CreateFromHandle(
- handle, size, format, base::Bind(&GpuMemoryBufferDeleted, handle)));
+ handle,
+ size,
+ format,
+ base::Bind(&GpuMemoryBufferDeleted, handle.id, client_id)));
}
void GpuMemoryBufferCreatedForChildProcess(
@@ -42,11 +44,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() {
@@ -54,37 +56,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,
- base::Bind(&GpuMemoryBufferCreated, size, format, callback));
+ client_id,
+ base::Bind(&GpuMemoryBufferCreated, size, format, client_id, 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));
}
@@ -99,18 +99,16 @@ GpuMemoryBufferImplOzoneNativeBuffer::CreateFromHandle(
return make_scoped_ptr<GpuMemoryBufferImpl>(
new GpuMemoryBufferImplOzoneNativeBuffer(
- size, format, callback, handle.global_id));
+ handle.id, size, format, callback));
}
// static
void GpuMemoryBufferImplOzoneNativeBuffer::DeletedByChildProcess(
- const gfx::GpuMemoryBufferId& id,
+ gfx::GpuMemoryBufferId id,
+ int child_client_id,
uint32_t sync_point) {
- gfx::GpuMemoryBufferHandle handle;
- handle.type = gfx::OZONE_NATIVE_BUFFER;
- handle.global_id = id;
- GpuMemoryBufferFactoryHost::GetInstance()->DestroyGpuMemoryBuffer(handle,
- sync_point);
+ GpuMemoryBufferFactoryHost::GetInstance()->DestroyGpuMemoryBuffer(
+ gfx::OZONE_NATIVE_BUFFER, id, child_client_id, sync_point);
}
// static
@@ -165,7 +163,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