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

Side by Side Diff: gpu/ipc/client/gpu_memory_buffer_impl.cc

Issue 2572703004: exo: Directly create GpuMemoryBufferImpl when a handle is available. (Closed)
Patch Set: null callback Created 4 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "gpu/ipc/client/gpu_memory_buffer_impl.h" 5 #include "gpu/ipc/client/gpu_memory_buffer_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h" 9 #include "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h"
10 10
(...skipping 12 matching lines...) Expand all
23 gfx::BufferFormat format, 23 gfx::BufferFormat format,
24 const DestructionCallback& callback) 24 const DestructionCallback& callback)
25 : id_(id), 25 : id_(id),
26 size_(size), 26 size_(size),
27 format_(format), 27 format_(format),
28 callback_(callback), 28 callback_(callback),
29 mapped_(false) {} 29 mapped_(false) {}
30 30
31 GpuMemoryBufferImpl::~GpuMemoryBufferImpl() { 31 GpuMemoryBufferImpl::~GpuMemoryBufferImpl() {
32 DCHECK(!mapped_); 32 DCHECK(!mapped_);
33 callback_.Run(destruction_sync_token_); 33 if (!callback_.is_null())
34 callback_.Run(destruction_sync_token_);
34 } 35 }
35 36
36 // static 37 // static
37 std::unique_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( 38 std::unique_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle(
38 const gfx::GpuMemoryBufferHandle& handle, 39 const gfx::GpuMemoryBufferHandle& handle,
39 const gfx::Size& size, 40 const gfx::Size& size,
40 gfx::BufferFormat format, 41 gfx::BufferFormat format,
41 gfx::BufferUsage usage, 42 gfx::BufferUsage usage,
42 const DestructionCallback& callback) { 43 const DestructionCallback& callback) {
43 switch (handle.type) { 44 switch (handle.type) {
(...skipping 26 matching lines...) Expand all
70 71
71 gfx::GpuMemoryBufferId GpuMemoryBufferImpl::GetId() const { 72 gfx::GpuMemoryBufferId GpuMemoryBufferImpl::GetId() const {
72 return id_; 73 return id_;
73 } 74 }
74 75
75 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { 76 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() {
76 return reinterpret_cast<ClientBuffer>(this); 77 return reinterpret_cast<ClientBuffer>(this);
77 } 78 }
78 79
79 } // namespace gpu 80 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/client/gpu_memory_buffer_impl.h ('k') | services/ui/common/server_gpu_memory_buffer_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698