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

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

Issue 1859703002: convert //gpu to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master 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 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 "gpu/ipc/client/gpu_memory_buffer_impl_surface_texture.h" 5 #include "gpu/ipc/client/gpu_memory_buffer_impl_surface_texture.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h"
8 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
9 #include "gpu/ipc/common/android/surface_texture_manager.h" 10 #include "gpu/ipc/common/android/surface_texture_manager.h"
10 #include "gpu/ipc/common/gpu_memory_buffer_support.h" 11 #include "gpu/ipc/common/gpu_memory_buffer_support.h"
11 #include "ui/gfx/buffer_format_util.h" 12 #include "ui/gfx/buffer_format_util.h"
12 #include "ui/gl/android/surface_texture.h" 13 #include "ui/gl/android/surface_texture.h"
13 #include "ui/gl/gl_bindings.h" 14 #include "ui/gl/gl_bindings.h"
14 15
15 namespace gpu { 16 namespace gpu {
16 namespace { 17 namespace {
17 18
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 const DestructionCallback& callback, 56 const DestructionCallback& callback,
56 ANativeWindow* native_window) 57 ANativeWindow* native_window)
57 : GpuMemoryBufferImpl(id, size, format, callback), 58 : GpuMemoryBufferImpl(id, size, format, callback),
58 native_window_(native_window) {} 59 native_window_(native_window) {}
59 60
60 GpuMemoryBufferImplSurfaceTexture::~GpuMemoryBufferImplSurfaceTexture() { 61 GpuMemoryBufferImplSurfaceTexture::~GpuMemoryBufferImplSurfaceTexture() {
61 ANativeWindow_release(native_window_); 62 ANativeWindow_release(native_window_);
62 } 63 }
63 64
64 // static 65 // static
65 scoped_ptr<GpuMemoryBufferImplSurfaceTexture> 66 std::unique_ptr<GpuMemoryBufferImplSurfaceTexture>
66 GpuMemoryBufferImplSurfaceTexture::CreateFromHandle( 67 GpuMemoryBufferImplSurfaceTexture::CreateFromHandle(
67 const gfx::GpuMemoryBufferHandle& handle, 68 const gfx::GpuMemoryBufferHandle& handle,
68 const gfx::Size& size, 69 const gfx::Size& size,
69 gfx::BufferFormat format, 70 gfx::BufferFormat format,
70 gfx::BufferUsage usage, 71 gfx::BufferUsage usage,
71 const DestructionCallback& callback) { 72 const DestructionCallback& callback) {
72 ANativeWindow* native_window = 73 ANativeWindow* native_window =
73 gpu::SurfaceTextureManager::GetInstance() 74 gpu::SurfaceTextureManager::GetInstance()
74 ->AcquireNativeWidgetForSurfaceTexture(handle.id.id); 75 ->AcquireNativeWidgetForSurfaceTexture(handle.id.id);
75 if (!native_window) 76 if (!native_window)
76 return nullptr; 77 return nullptr;
77 78
78 ANativeWindow_setBuffersGeometry(native_window, size.width(), size.height(), 79 ANativeWindow_setBuffersGeometry(native_window, size.width(), size.height(),
79 WindowFormat(format)); 80 WindowFormat(format));
80 81
81 return make_scoped_ptr(new GpuMemoryBufferImplSurfaceTexture( 82 return base::WrapUnique(new GpuMemoryBufferImplSurfaceTexture(
82 handle.id, size, format, callback, native_window)); 83 handle.id, size, format, callback, native_window));
83 } 84 }
84 85
85 // static 86 // static
86 bool GpuMemoryBufferImplSurfaceTexture::IsConfigurationSupported( 87 bool GpuMemoryBufferImplSurfaceTexture::IsConfigurationSupported(
87 gfx::BufferFormat format, 88 gfx::BufferFormat format,
88 gfx::BufferUsage usage) { 89 gfx::BufferUsage usage) {
89 return gpu::IsNativeGpuMemoryBufferConfigurationSupported(format, usage); 90 return gpu::IsNativeGpuMemoryBufferConfigurationSupported(format, usage);
90 } 91 }
91 92
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 142
142 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSurfaceTexture::GetHandle() 143 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSurfaceTexture::GetHandle()
143 const { 144 const {
144 gfx::GpuMemoryBufferHandle handle; 145 gfx::GpuMemoryBufferHandle handle;
145 handle.type = gfx::SURFACE_TEXTURE_BUFFER; 146 handle.type = gfx::SURFACE_TEXTURE_BUFFER;
146 handle.id = id_; 147 handle.id = id_;
147 return handle; 148 return handle;
148 } 149 }
149 150
150 } // namespace gpu 151 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/client/gpu_memory_buffer_impl_surface_texture.h ('k') | gpu/ipc/client/gpu_memory_buffer_impl_test_template.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698