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

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

Issue 1827123002: Move content/common/gpu/client to gpu/ipc/client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 4 years, 8 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 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 "content/common/gpu/client/gpu_memory_buffer_impl_io_surface.h" 5 #include "gpu/ipc/client/gpu_memory_buffer_impl_io_surface.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "gpu/ipc/common/gpu_memory_buffer_support.h" 8 #include "gpu/ipc/common/gpu_memory_buffer_support.h"
9 #include "ui/gfx/buffer_format_util.h" 9 #include "ui/gfx/buffer_format_util.h"
10 #include "ui/gfx/mac/io_surface.h" 10 #include "ui/gfx/mac/io_surface.h"
11 11
12 namespace content { 12 namespace gpu {
13 namespace { 13 namespace {
14 14
15 uint32_t LockFlags(gfx::BufferUsage usage) { 15 uint32_t LockFlags(gfx::BufferUsage usage) {
16 switch (usage) { 16 switch (usage) {
17 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: 17 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE:
18 return kIOSurfaceLockAvoidSync; 18 return kIOSurfaceLockAvoidSync;
19 case gfx::BufferUsage::GPU_READ: 19 case gfx::BufferUsage::GPU_READ:
20 case gfx::BufferUsage::SCANOUT: 20 case gfx::BufferUsage::SCANOUT:
21 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: 21 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT:
22 return 0; 22 return 0;
23 } 23 }
24 NOTREACHED(); 24 NOTREACHED();
25 return 0; 25 return 0;
26 } 26 }
27 27
28 void NoOp() { 28 void NoOp() {}
29 }
30 29
31 } // namespace 30 } // namespace
32 31
33 GpuMemoryBufferImplIOSurface::GpuMemoryBufferImplIOSurface( 32 GpuMemoryBufferImplIOSurface::GpuMemoryBufferImplIOSurface(
34 gfx::GpuMemoryBufferId id, 33 gfx::GpuMemoryBufferId id,
35 const gfx::Size& size, 34 const gfx::Size& size,
36 gfx::BufferFormat format, 35 gfx::BufferFormat format,
37 const DestructionCallback& callback, 36 const DestructionCallback& callback,
38 IOSurfaceRef io_surface, 37 IOSurfaceRef io_surface,
39 uint32_t lock_flags) 38 uint32_t lock_flags)
40 : GpuMemoryBufferImpl(id, size, format, callback), 39 : GpuMemoryBufferImpl(id, size, format, callback),
41 io_surface_(io_surface), 40 io_surface_(io_surface),
42 lock_flags_(lock_flags) {} 41 lock_flags_(lock_flags) {}
43 42
44 GpuMemoryBufferImplIOSurface::~GpuMemoryBufferImplIOSurface() { 43 GpuMemoryBufferImplIOSurface::~GpuMemoryBufferImplIOSurface() {}
45 }
46 44
47 // static 45 // static
48 scoped_ptr<GpuMemoryBufferImplIOSurface> 46 scoped_ptr<GpuMemoryBufferImplIOSurface>
49 GpuMemoryBufferImplIOSurface::CreateFromHandle( 47 GpuMemoryBufferImplIOSurface::CreateFromHandle(
50 const gfx::GpuMemoryBufferHandle& handle, 48 const gfx::GpuMemoryBufferHandle& handle,
51 const gfx::Size& size, 49 const gfx::Size& size,
52 gfx::BufferFormat format, 50 gfx::BufferFormat format,
53 gfx::BufferUsage usage, 51 gfx::BufferUsage usage,
54 const DestructionCallback& callback) { 52 const DestructionCallback& callback) {
55 base::ScopedCFTypeRef<IOSurfaceRef> io_surface( 53 base::ScopedCFTypeRef<IOSurfaceRef> io_surface(
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 return IOSurfaceGetBytesPerRowOfPlane(io_surface_, plane); 112 return IOSurfaceGetBytesPerRowOfPlane(io_surface_, plane);
115 } 113 }
116 114
117 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const { 115 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const {
118 gfx::GpuMemoryBufferHandle handle; 116 gfx::GpuMemoryBufferHandle handle;
119 handle.type = gfx::IO_SURFACE_BUFFER; 117 handle.type = gfx::IO_SURFACE_BUFFER;
120 handle.id = id_; 118 handle.id = id_;
121 return handle; 119 return handle;
122 } 120 }
123 121
124 } // namespace content 122 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/client/gpu_memory_buffer_impl_io_surface.h ('k') | gpu/ipc/client/gpu_memory_buffer_impl_io_surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698