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

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

Issue 596833002: content: Fix layering violation in GpuMemoryBufferImplOzoneNativeBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix another typo Created 6 years, 3 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/gpu_memory_buffer_impl_ozone_native_buffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 62e722de8e6de384c7a11753d8d786162894e0f0..cb5c4a5166f1c51506e0435774c0535359cbd34f 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
@@ -14,13 +14,29 @@ namespace {
base::StaticAtomicSequenceNumber g_next_buffer_id;
-void AllocatedOzoneNativeBuffer(
+void GpuMemoryBufferCreated(
const gfx::Size& size,
unsigned internalformat,
const GpuMemoryBufferImpl::CreationCallback& callback,
const gfx::GpuMemoryBufferHandle& handle) {
- callback.Run(
- GpuMemoryBufferImpl::CreateFromHandle(handle, size, internalformat));
+ DCHECK_EQ(gfx::OZONE_NATIVE_BUFFER, handle.type);
+
+ scoped_ptr<GpuMemoryBufferImplOzoneNativeBuffer> buffer(
+ new GpuMemoryBufferImplOzoneNativeBuffer(size, internalformat));
+ if (!buffer->InitializeFromHandle(handle)) {
+ callback.Run(scoped_ptr<GpuMemoryBufferImpl>());
+ return;
+ }
+
+ callback.Run(buffer.PassAs<GpuMemoryBufferImpl>());
+}
+
+void GpuMemoryBufferCreatedForChildProcess(
+ const GpuMemoryBufferImpl::AllocationCallback& callback,
+ const gfx::GpuMemoryBufferHandle& handle) {
+ DCHECK_EQ(gfx::OZONE_NATIVE_BUFFER, handle.type);
+
+ callback.Run(handle);
}
} // namespace
@@ -50,11 +66,12 @@ void GpuMemoryBufferImplOzoneNativeBuffer::Create(
size,
internalformat,
usage,
- base::Bind(&AllocatedOzoneNativeBuffer, size, internalformat, callback));
+ base::Bind(&GpuMemoryBufferCreated, size, internalformat, callback));
}
// static
-void GpuMemoryBufferImplOzoneNativeBuffer::AllocateOzoneNativeBufferForChildId(
+void
+GpuMemoryBufferImplOzoneNativeBuffer::AllocateOzoneNativeBufferForChildProcess(
const gfx::Size& size,
unsigned internalformat,
unsigned usage,
@@ -69,7 +86,7 @@ void GpuMemoryBufferImplOzoneNativeBuffer::AllocateOzoneNativeBufferForChildId(
size,
internalformat,
usage,
- base::Bind(&OnGpuMemoryBufferCreated, callback));
+ base::Bind(&GpuMemoryBufferCreatedForChildProcess, callback));
}
// static
@@ -128,10 +145,4 @@ gfx::GpuMemoryBufferHandle GpuMemoryBufferImplOzoneNativeBuffer::GetHandle()
return handle;
}
-void GpuMemoryBufferImplOzoneNativeBuffer::OnGpuMemoryBufferCreated(
- const AllocationCallback& callback,
- const gfx::GpuMemoryBufferHandle& handle) {
- callback.Run(handle);
-}
-
} // namespace content
« no previous file with comments | « content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698