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

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

Issue 2042553002: Mac CoreAnimation compositor in the browser process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lock_directly
Patch Set: Created 4 years, 6 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 "gpu/ipc/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 "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "gpu/ipc/common/gpu_memory_buffer_support.h" 9 #include "gpu/ipc/common/gpu_memory_buffer_support.h"
10 #include "ui/gfx/buffer_format_util.h" 10 #include "ui/gfx/buffer_format_util.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 base::ScopedCFTypeRef<IOSurfaceRef> io_surface( 77 base::ScopedCFTypeRef<IOSurfaceRef> io_surface(
78 gfx::CreateIOSurface(size, format)); 78 gfx::CreateIOSurface(size, format));
79 DCHECK(io_surface); 79 DCHECK(io_surface);
80 gfx::GpuMemoryBufferId kBufferId(1); 80 gfx::GpuMemoryBufferId kBufferId(1);
81 handle->type = gfx::IO_SURFACE_BUFFER; 81 handle->type = gfx::IO_SURFACE_BUFFER;
82 handle->id = kBufferId; 82 handle->id = kBufferId;
83 handle->mach_port.reset(IOSurfaceCreateMachPort(io_surface)); 83 handle->mach_port.reset(IOSurfaceCreateMachPort(io_surface));
84 return base::Bind(&NoOp); 84 return base::Bind(&NoOp);
85 } 85 }
86 86
87 void* GpuMemoryBufferImplIOSurface::GetIOSurface() {
88 return io_surface_.get();
89 }
90
87 bool GpuMemoryBufferImplIOSurface::Map() { 91 bool GpuMemoryBufferImplIOSurface::Map() {
88 DCHECK(!mapped_); 92 DCHECK(!mapped_);
89 IOReturn status = IOSurfaceLock(io_surface_, lock_flags_, NULL); 93 IOReturn status = IOSurfaceLock(io_surface_, lock_flags_, NULL);
90 DCHECK_NE(status, kIOReturnCannotLock); 94 DCHECK_NE(status, kIOReturnCannotLock);
91 mapped_ = true; 95 mapped_ = true;
92 return true; 96 return true;
93 } 97 }
94 98
95 void* GpuMemoryBufferImplIOSurface::memory(size_t plane) { 99 void* GpuMemoryBufferImplIOSurface::memory(size_t plane) {
96 DCHECK(mapped_); 100 DCHECK(mapped_);
(...skipping 18 matching lines...) Expand all
115 119
116 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const { 120 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const {
117 gfx::GpuMemoryBufferHandle handle; 121 gfx::GpuMemoryBufferHandle handle;
118 handle.type = gfx::IO_SURFACE_BUFFER; 122 handle.type = gfx::IO_SURFACE_BUFFER;
119 handle.id = id_; 123 handle.id = id_;
120 handle.mach_port.reset(IOSurfaceCreateMachPort(io_surface_)); 124 handle.mach_port.reset(IOSurfaceCreateMachPort(io_surface_));
121 return handle; 125 return handle;
122 } 126 }
123 127
124 } // namespace gpu 128 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/client/gpu_memory_buffer_impl_io_surface.h ('k') | gpu/ipc/service/image_transport_surface_overlay_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698