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

Side by Side Diff: ui/ozone/platform/drm/gpu/gbm_surface_factory.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr 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 "ui/ozone/platform/drm/gpu/gbm_surface_factory.h" 5 #include "ui/ozone/platform/drm/gpu/gbm_surface_factory.h"
6 6
7 #include <gbm.h> 7 #include <gbm.h>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/memory/ptr_util.h"
10 #include "build/build_config.h" 11 #include "build/build_config.h"
11 #include "third_party/khronos/EGL/egl.h" 12 #include "third_party/khronos/EGL/egl.h"
12 #include "ui/ozone/common/egl_util.h" 13 #include "ui/ozone/common/egl_util.h"
13 #include "ui/ozone/platform/drm/common/drm_util.h" 14 #include "ui/ozone/platform/drm/common/drm_util.h"
14 #include "ui/ozone/platform/drm/gpu/drm_thread_proxy.h" 15 #include "ui/ozone/platform/drm/gpu/drm_thread_proxy.h"
15 #include "ui/ozone/platform/drm/gpu/drm_window_proxy.h" 16 #include "ui/ozone/platform/drm/gpu/drm_window_proxy.h"
16 #include "ui/ozone/platform/drm/gpu/gbm_buffer.h" 17 #include "ui/ozone/platform/drm/gpu/gbm_buffer.h"
17 #include "ui/ozone/platform/drm/gpu/gbm_surfaceless.h" 18 #include "ui/ozone/platform/drm/gpu/gbm_surfaceless.h"
18 #include "ui/ozone/platform/drm/gpu/proxy_helpers.h" 19 #include "ui/ozone/platform/drm/gpu/proxy_helpers.h"
19 #include "ui/ozone/platform/drm/gpu/screen_manager.h" 20 #include "ui/ozone/platform/drm/gpu/screen_manager.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return EGL_DEFAULT_DISPLAY; 55 return EGL_DEFAULT_DISPLAY;
55 } 56 }
56 57
57 bool GbmSurfaceFactory::LoadEGLGLES2Bindings( 58 bool GbmSurfaceFactory::LoadEGLGLES2Bindings(
58 AddGLLibraryCallback add_gl_library, 59 AddGLLibraryCallback add_gl_library,
59 SetGLGetProcAddressProcCallback set_gl_get_proc_address) { 60 SetGLGetProcAddressProcCallback set_gl_get_proc_address) {
60 DCHECK(thread_checker_.CalledOnValidThread()); 61 DCHECK(thread_checker_.CalledOnValidThread());
61 return LoadDefaultEGLGLES2Bindings(add_gl_library, set_gl_get_proc_address); 62 return LoadDefaultEGLGLES2Bindings(add_gl_library, set_gl_get_proc_address);
62 } 63 }
63 64
64 scoped_ptr<SurfaceOzoneCanvas> GbmSurfaceFactory::CreateCanvasForWidget( 65 std::unique_ptr<SurfaceOzoneCanvas> GbmSurfaceFactory::CreateCanvasForWidget(
65 gfx::AcceleratedWidget widget) { 66 gfx::AcceleratedWidget widget) {
66 DCHECK(thread_checker_.CalledOnValidThread()); 67 DCHECK(thread_checker_.CalledOnValidThread());
67 LOG(ERROR) << "Software rendering mode is not supported with GBM platform"; 68 LOG(ERROR) << "Software rendering mode is not supported with GBM platform";
68 return nullptr; 69 return nullptr;
69 } 70 }
70 71
71 scoped_ptr<SurfaceOzoneEGL> GbmSurfaceFactory::CreateEGLSurfaceForWidget( 72 std::unique_ptr<SurfaceOzoneEGL> GbmSurfaceFactory::CreateEGLSurfaceForWidget(
72 gfx::AcceleratedWidget widget) { 73 gfx::AcceleratedWidget widget) {
73 NOTREACHED(); 74 NOTREACHED();
74 return nullptr; 75 return nullptr;
75 } 76 }
76 77
77 scoped_ptr<SurfaceOzoneEGL> 78 std::unique_ptr<SurfaceOzoneEGL>
78 GbmSurfaceFactory::CreateSurfacelessEGLSurfaceForWidget( 79 GbmSurfaceFactory::CreateSurfacelessEGLSurfaceForWidget(
79 gfx::AcceleratedWidget widget) { 80 gfx::AcceleratedWidget widget) {
80 DCHECK(thread_checker_.CalledOnValidThread()); 81 DCHECK(thread_checker_.CalledOnValidThread());
81 return make_scoped_ptr( 82 return base::WrapUnique(
82 new GbmSurfaceless(drm_thread_->CreateDrmWindowProxy(widget), this)); 83 new GbmSurfaceless(drm_thread_->CreateDrmWindowProxy(widget), this));
83 } 84 }
84 85
85 std::vector<gfx::BufferFormat> GbmSurfaceFactory::GetScanoutFormats( 86 std::vector<gfx::BufferFormat> GbmSurfaceFactory::GetScanoutFormats(
86 gfx::AcceleratedWidget widget) { 87 gfx::AcceleratedWidget widget) {
87 std::vector<gfx::BufferFormat> scanout_formats; 88 std::vector<gfx::BufferFormat> scanout_formats;
88 drm_thread_->GetScanoutFormats(widget, &scanout_formats); 89 drm_thread_->GetScanoutFormats(widget, &scanout_formats);
89 return scanout_formats; 90 return scanout_formats;
90 } 91 }
91 92
(...skipping 22 matching lines...) Expand all
114 const gfx::NativePixmapHandle& handle) { 115 const gfx::NativePixmapHandle& handle) {
115 scoped_refptr<GbmBuffer> buffer = drm_thread_->CreateBufferFromFD( 116 scoped_refptr<GbmBuffer> buffer = drm_thread_->CreateBufferFromFD(
116 size, format, base::ScopedFD(handle.fd.fd), handle.stride); 117 size, format, base::ScopedFD(handle.fd.fd), handle.stride);
117 if (!buffer) 118 if (!buffer)
118 return nullptr; 119 return nullptr;
119 120
120 return make_scoped_refptr(new GbmPixmap(this, buffer)); 121 return make_scoped_refptr(new GbmPixmap(this, buffer));
121 } 122 }
122 123
123 } // namespace ui 124 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/gbm_surface_factory.h ('k') | ui/ozone/platform/drm/gpu/gbm_surfaceless.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698