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

Unified Diff: content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.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_surface_texture.cc
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.cc b/content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.cc
index 20f77a1681c90335777f8c44824c78a26f09534c..0b46c3f5be8b8ec851e84d0b69fffd572bb929a5 100644
--- a/content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.cc
+++ b/content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.cc
@@ -4,7 +4,6 @@
#include "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h"
-#include "base/atomic_sequence_num.h"
#include "base/bind.h"
#include "base/debug/trace_event.h"
#include "base/logging.h"
@@ -15,8 +14,6 @@
namespace content {
namespace {
-base::StaticAtomicSequenceNumber g_next_buffer_id;
-
void Noop() {
}
@@ -42,13 +39,13 @@ void GpuMemoryBufferCreatedForChildProcess(
} // namespace
GpuMemoryBufferImplSurfaceTexture::GpuMemoryBufferImplSurfaceTexture(
+ gfx::GpuMemoryBufferId id,
const gfx::Size& size,
Format format,
const DestructionCallback& callback,
const gfx::GpuMemoryBufferId& id,
ANativeWindow* native_window)
- : GpuMemoryBufferImpl(size, format, callback),
- id_(id),
+ : GpuMemoryBufferImpl(id, size, format, callback),
native_window_(native_window),
stride_(0u) {
}
@@ -59,37 +56,34 @@ GpuMemoryBufferImplSurfaceTexture::~GpuMemoryBufferImplSurfaceTexture() {
// static
void GpuMemoryBufferImplSurfaceTexture::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::SURFACE_TEXTURE_BUFFER;
GpuMemoryBufferFactoryHost::GetInstance()->CreateGpuMemoryBuffer(
- handle,
+ gfx::SURFACE_TEXTURE_BUFFER,
+ id,
size,
format,
MAP,
+ client_id,
base::Bind(&GpuMemoryBufferCreated, size, format, callback));
}
// static
void GpuMemoryBufferImplSurfaceTexture::AllocateForChildProcess(
- const gfx::Size& size,
+ gfx::GpuMemoryBufferId id,
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::SURFACE_TEXTURE_BUFFER;
GpuMemoryBufferFactoryHost::GetInstance()->CreateGpuMemoryBuffer(
- handle,
+ gfx::SURFACE_TEXTURE_BUFFER,
+ id,
size,
format,
MAP,
+ child_client_id,
base::Bind(&GpuMemoryBufferCreatedForChildProcess, callback));
}
@@ -103,8 +97,7 @@ GpuMemoryBufferImplSurfaceTexture::CreateFromHandle(
DCHECK(IsFormatSupported(format));
ANativeWindow* native_window =
- SurfaceTextureManager::GetInstance()->AcquireNativeWidget(
- handle.global_id.primary_id, handle.global_id.secondary_id);
+ SurfaceTextureManager::GetInstance()->AcquireNativeWidget(handle.id);
if (!native_window)
return scoped_ptr<GpuMemoryBufferImpl>();
@@ -113,7 +106,7 @@ GpuMemoryBufferImplSurfaceTexture::CreateFromHandle(
return make_scoped_ptr<GpuMemoryBufferImpl>(
new GpuMemoryBufferImplSurfaceTexture(
- size, format, callback, handle.global_id, native_window));
+ id, size, format, callback, native_window));
}
// static
@@ -198,7 +191,7 @@ gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSurfaceTexture::GetHandle()
const {
gfx::GpuMemoryBufferHandle handle;
handle.type = gfx::SURFACE_TEXTURE_BUFFER;
- handle.global_id = id_;
+ handle.id = id_;
return handle;
}

Powered by Google App Engine
This is Rietveld 408576698