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

Side by Side Diff: content/common/gpu/client/gpu_memory_buffer_impl_ozone.cc

Issue 654223006: Cleanup GpuMemoryBuffer (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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" 5 #include "content/common/gpu/client/gpu_memory_buffer_impl.h"
6 6
7 #include "content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.h " 7 #include "content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.h "
8 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" 8 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h"
9 9
10 namespace content { 10 namespace content {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 return; 53 return;
54 } 54 }
55 55
56 callback.Run(gfx::GpuMemoryBufferHandle()); 56 callback.Run(gfx::GpuMemoryBufferHandle());
57 } 57 }
58 58
59 // static 59 // static
60 void GpuMemoryBufferImpl::DeletedByChildProcess( 60 void GpuMemoryBufferImpl::DeletedByChildProcess(
61 gfx::GpuMemoryBufferType type, 61 gfx::GpuMemoryBufferType type,
62 const gfx::GpuMemoryBufferId& id, 62 const gfx::GpuMemoryBufferId& id,
63 base::ProcessHandle child_process) { 63 base::ProcessHandle child_process,
64 int child_client_id,
65 uint32_t sync_point) {
66 switch (type) {
67 case gfx::SHARED_MEMORY_BUFFER:
68 break;
69 case gfx::OZONE_NATIVE_BUFFER:
70 if (id.secondary_id != child_client_id) {
71 LOG(ERROR)
72 << "Child attempting to delete GpuMemoryBuffer it does not own";
73 } else {
74 GpuMemoryBufferImplOzoneNativeBuffer::DeletedByChildProcess(id,
75 sync_point);
76 }
77 break;
78 default:
79 LOG(ERROR) << "Unexpected GpuMemoryBufferType";
reveman 2014/11/04 00:16:13 NOTREACHED();
80 }
64 } 81 }
65 82
66 // static 83 // static
67 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( 84 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle(
68 const gfx::GpuMemoryBufferHandle& handle, 85 const gfx::GpuMemoryBufferHandle& handle,
69 const gfx::Size& size, 86 const gfx::Size& size,
70 Format format, 87 Format format,
71 const DestructionCallback& callback) { 88 const DestructionCallback& callback) {
72 switch (handle.type) { 89 switch (handle.type) {
73 case gfx::SHARED_MEMORY_BUFFER: 90 case gfx::SHARED_MEMORY_BUFFER:
74 return GpuMemoryBufferImplSharedMemory::CreateFromHandle( 91 return GpuMemoryBufferImplSharedMemory::CreateFromHandle(
75 handle, size, format, callback); 92 handle, size, format, callback);
76 case gfx::OZONE_NATIVE_BUFFER: 93 case gfx::OZONE_NATIVE_BUFFER:
77 return GpuMemoryBufferImplOzoneNativeBuffer::CreateFromHandle( 94 return GpuMemoryBufferImplOzoneNativeBuffer::CreateFromHandle(
78 handle, size, format, callback); 95 handle, size, format, callback);
79 default: 96 default:
80 return scoped_ptr<GpuMemoryBufferImpl>(); 97 return scoped_ptr<GpuMemoryBufferImpl>();
81 } 98 }
82 } 99 }
83 100
84 } // namespace content 101 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698