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/gfx/ozone/surface_factory_ozone.h" | 5 #include "ui/gfx/ozone/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 "ui/gfx/ozone/surface_ozone_canvas.h" | 10 #include "ui/gfx/ozone/surface_ozone_canvas.h" |
11 #include "ui/gfx/ozone/surface_ozone_egl.h" | 11 #include "ui/gfx/ozone/surface_ozone_egl.h" |
12 | 12 |
13 namespace gfx { | 13 namespace gfx { |
14 | 14 |
15 // static | 15 // static |
16 SurfaceFactoryOzone* SurfaceFactoryOzone::impl_ = NULL; | 16 SurfaceFactoryOzone* SurfaceFactoryOzone::impl_ = NULL; |
17 | 17 |
18 SurfaceFactoryOzone::SurfaceFactoryOzone() { | 18 SurfaceFactoryOzone::SurfaceFactoryOzone() { |
| 19 CHECK(!impl_) << "There should only be a single SurfaceFactoryOzone."; |
| 20 impl_ = this; |
19 } | 21 } |
20 | 22 |
21 SurfaceFactoryOzone::~SurfaceFactoryOzone() { | 23 SurfaceFactoryOzone::~SurfaceFactoryOzone() { |
| 24 CHECK_EQ(impl_, this); |
| 25 impl_ = NULL; |
22 } | 26 } |
23 | 27 |
24 SurfaceFactoryOzone* SurfaceFactoryOzone::GetInstance() { | 28 SurfaceFactoryOzone* SurfaceFactoryOzone::GetInstance() { |
25 CHECK(impl_) << "No SurfaceFactoryOzone implementation set."; | 29 CHECK(impl_) << "No SurfaceFactoryOzone implementation set."; |
26 return impl_; | 30 return impl_; |
27 } | 31 } |
28 | 32 |
29 void SurfaceFactoryOzone::SetInstance(SurfaceFactoryOzone* impl) { | |
30 impl_ = impl; | |
31 } | |
32 | |
33 intptr_t SurfaceFactoryOzone::GetNativeDisplay() { | 33 intptr_t SurfaceFactoryOzone::GetNativeDisplay() { |
34 return 0; | 34 return 0; |
35 } | 35 } |
36 | 36 |
37 scoped_ptr<SurfaceOzoneEGL> SurfaceFactoryOzone::CreateEGLSurfaceForWidget( | 37 scoped_ptr<SurfaceOzoneEGL> SurfaceFactoryOzone::CreateEGLSurfaceForWidget( |
38 gfx::AcceleratedWidget widget) { | 38 gfx::AcceleratedWidget widget) { |
39 NOTIMPLEMENTED(); | 39 NOTIMPLEMENTED(); |
40 return scoped_ptr<SurfaceOzoneEGL>(); | 40 return scoped_ptr<SurfaceOzoneEGL>(); |
41 } | 41 } |
42 | 42 |
(...skipping 24 matching lines...) Expand all Loading... |
67 NOTREACHED(); | 67 NOTREACHED(); |
68 } | 68 } |
69 | 69 |
70 gfx::NativeBufferOzone SurfaceFactoryOzone::CreateNativeBuffer( | 70 gfx::NativeBufferOzone SurfaceFactoryOzone::CreateNativeBuffer( |
71 gfx::Size size, | 71 gfx::Size size, |
72 BufferFormat format) { | 72 BufferFormat format) { |
73 return 0; | 73 return 0; |
74 } | 74 } |
75 | 75 |
76 } // namespace gfx | 76 } // namespace gfx |
OLD | NEW |