Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/ozone/public/surface_factory_ozone.h" | 5 #include "ui/ozone/public/surface_factory_ozone.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/lazy_instance.h" | |
| 10 #include "ui/ozone/public/native_pixmap.h" | 11 #include "ui/ozone/public/native_pixmap.h" |
| 11 #include "ui/ozone/public/surface_ozone_canvas.h" | 12 #include "ui/ozone/public/surface_ozone_canvas.h" |
| 12 #include "ui/ozone/public/surface_ozone_egl.h" | 13 #include "ui/ozone/public/surface_ozone_egl.h" |
| 13 | 14 |
| 14 namespace ui { | 15 namespace ui { |
| 15 | 16 |
| 16 // static | 17 namespace { |
| 17 SurfaceFactoryOzone* SurfaceFactoryOzone::impl_ = NULL; | 18 |
| 19 base::LazyInstance<SurfaceFactoryOzone*>::Leaky g_impl = | |
|
spang
2015/05/07 17:20:45
Please drop these unrelated changes.
I don't thin
dshwang
2015/05/15 18:11:20
Done.
| |
| 20 LAZY_INSTANCE_INITIALIZER; | |
| 21 | |
| 22 } // namespace | |
| 18 | 23 |
| 19 SurfaceFactoryOzone::SurfaceFactoryOzone() { | 24 SurfaceFactoryOzone::SurfaceFactoryOzone() { |
| 20 DCHECK(!impl_) << "There should only be a single SurfaceFactoryOzone."; | 25 DCHECK(!g_impl.Get()) << "There should only be a single SurfaceFactoryOzone."; |
| 21 impl_ = this; | 26 *g_impl.Pointer() = this; |
| 22 } | 27 } |
| 23 | 28 |
| 24 SurfaceFactoryOzone::~SurfaceFactoryOzone() { | 29 SurfaceFactoryOzone::~SurfaceFactoryOzone() { |
| 25 DCHECK_EQ(impl_, this); | 30 DCHECK_EQ(g_impl.Get(), this); |
| 26 impl_ = NULL; | 31 *g_impl.Pointer() = nullptr; |
| 27 } | 32 } |
| 28 | 33 |
| 29 SurfaceFactoryOzone* SurfaceFactoryOzone::GetInstance() { | 34 SurfaceFactoryOzone* SurfaceFactoryOzone::GetInstance() { |
| 30 DCHECK(impl_) << "No SurfaceFactoryOzone implementation set."; | 35 DCHECK(g_impl.Get()) << "No SurfaceFactoryOzone implementation set."; |
| 31 return impl_; | 36 return g_impl.Get(); |
| 32 } | 37 } |
| 33 | 38 |
| 34 intptr_t SurfaceFactoryOzone::GetNativeDisplay() { | 39 intptr_t SurfaceFactoryOzone::GetNativeDisplay() { |
| 35 return 0; | 40 return 0; |
| 36 } | 41 } |
| 37 | 42 |
| 38 int SurfaceFactoryOzone::GetDrmFd() { | 43 int SurfaceFactoryOzone::GetDrmFd() { |
| 39 return -1; | 44 return -1; |
| 40 } | 45 } |
| 41 | 46 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 58 return nullptr; | 63 return nullptr; |
| 59 } | 64 } |
| 60 | 65 |
| 61 const int32* SurfaceFactoryOzone::GetEGLSurfaceProperties( | 66 const int32* SurfaceFactoryOzone::GetEGLSurfaceProperties( |
| 62 const int32* desired_attributes) { | 67 const int32* desired_attributes) { |
| 63 return desired_attributes; | 68 return desired_attributes; |
| 64 } | 69 } |
| 65 | 70 |
| 66 ui::OverlayCandidatesOzone* SurfaceFactoryOzone::GetOverlayCandidates( | 71 ui::OverlayCandidatesOzone* SurfaceFactoryOzone::GetOverlayCandidates( |
| 67 gfx::AcceleratedWidget w) { | 72 gfx::AcceleratedWidget w) { |
| 68 return NULL; | 73 return nullptr; |
| 69 } | 74 } |
| 70 | 75 |
| 71 scoped_refptr<ui::NativePixmap> SurfaceFactoryOzone::CreateNativePixmap( | 76 scoped_refptr<ui::NativePixmap> SurfaceFactoryOzone::CreateNativePixmap( |
| 72 gfx::AcceleratedWidget widget, | 77 gfx::AcceleratedWidget widget, |
| 73 gfx::Size size, | 78 gfx::Size size, |
| 74 BufferFormat format, | 79 BufferFormat format, |
| 75 BufferUsage usage) { | 80 BufferUsage usage) { |
| 76 return NULL; | 81 return nullptr; |
| 77 } | 82 } |
| 78 | 83 |
| 79 bool SurfaceFactoryOzone::ScheduleOverlayPlane( | 84 bool SurfaceFactoryOzone::ScheduleOverlayPlane( |
| 80 gfx::AcceleratedWidget widget, | 85 gfx::AcceleratedWidget widget, |
| 81 int plane_z_order, | 86 int plane_z_order, |
| 82 gfx::OverlayTransform plane_transform, | 87 gfx::OverlayTransform plane_transform, |
| 83 scoped_refptr<NativePixmap> buffer, | 88 scoped_refptr<NativePixmap> buffer, |
| 84 const gfx::Rect& display_bounds, | 89 const gfx::Rect& display_bounds, |
| 85 const gfx::RectF& crop_rect) { | 90 const gfx::RectF& crop_rect) { |
| 86 return false; | 91 return false; |
| 87 } | 92 } |
| 88 | 93 |
| 89 bool SurfaceFactoryOzone::CanShowPrimaryPlaneAsOverlay() { | 94 bool SurfaceFactoryOzone::CanShowPrimaryPlaneAsOverlay() { |
| 90 return false; | 95 return false; |
| 91 } | 96 } |
| 92 | 97 |
| 93 bool SurfaceFactoryOzone::CanCreateNativePixmap(BufferUsage usage) { | 98 bool SurfaceFactoryOzone::CanCreateNativePixmap(BufferUsage usage) { |
| 94 return false; | 99 return false; |
| 95 } | 100 } |
| 96 | 101 |
| 97 } // namespace ui | 102 } // namespace ui |
| OLD | NEW |