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 "ui/gfx/ozone/impl/software_surface_factory_ozone.h" |
| 10 |
9 namespace gfx { | 11 namespace gfx { |
10 | 12 |
11 // static | 13 // static |
12 SurfaceFactoryOzone* SurfaceFactoryOzone::impl_ = NULL; | 14 SurfaceFactoryOzone* SurfaceFactoryOzone::impl_ = NULL; |
13 | 15 |
14 class SurfaceFactoryOzoneStub : public SurfaceFactoryOzone { | 16 class SurfaceFactoryOzoneStub : public SurfaceFactoryOzone { |
15 public: | 17 public: |
16 SurfaceFactoryOzoneStub() {} | 18 SurfaceFactoryOzoneStub() {} |
17 virtual ~SurfaceFactoryOzoneStub() {} | 19 virtual ~SurfaceFactoryOzoneStub() {} |
18 | 20 |
(...skipping 16 matching lines...) Expand all Loading... |
35 } | 37 } |
36 }; | 38 }; |
37 | 39 |
38 SurfaceFactoryOzone::SurfaceFactoryOzone() { | 40 SurfaceFactoryOzone::SurfaceFactoryOzone() { |
39 } | 41 } |
40 | 42 |
41 SurfaceFactoryOzone::~SurfaceFactoryOzone() { | 43 SurfaceFactoryOzone::~SurfaceFactoryOzone() { |
42 } | 44 } |
43 | 45 |
44 SurfaceFactoryOzone* SurfaceFactoryOzone::GetInstance() { | 46 SurfaceFactoryOzone* SurfaceFactoryOzone::GetInstance() { |
45 CHECK(impl_) << "SurfaceFactoryOzone accessed before constructed"; | 47 if (!impl_) { |
| 48 LOG(WARNING) << "No SurfaceFactoryOzone implementation set. Using default " |
| 49 "gfx::SoftwareSurfaceFactoryOzone."; |
| 50 impl_ = new SoftwareSurfaceFactoryOzone(); |
| 51 } |
46 return impl_; | 52 return impl_; |
47 } | 53 } |
48 | 54 |
49 void SurfaceFactoryOzone::SetInstance(SurfaceFactoryOzone* impl) { | 55 void SurfaceFactoryOzone::SetInstance(SurfaceFactoryOzone* impl) { |
50 impl_ = impl; | 56 impl_ = impl; |
51 } | 57 } |
52 | 58 |
53 const char* SurfaceFactoryOzone::DefaultDisplaySpec() { | 59 const char* SurfaceFactoryOzone::DefaultDisplaySpec() { |
54 char* envvar = getenv("ASH_DISPLAY_SPEC"); | 60 char* envvar = getenv("ASH_DISPLAY_SPEC"); |
55 if (envvar) | 61 if (envvar) |
(...skipping 17 matching lines...) Expand all Loading... |
73 const int32* desired_attributes) { | 79 const int32* desired_attributes) { |
74 return desired_attributes; | 80 return desired_attributes; |
75 } | 81 } |
76 | 82 |
77 // static | 83 // static |
78 SurfaceFactoryOzone* SurfaceFactoryOzone::CreateTestHelper() { | 84 SurfaceFactoryOzone* SurfaceFactoryOzone::CreateTestHelper() { |
79 return new SurfaceFactoryOzoneStub; | 85 return new SurfaceFactoryOzoneStub; |
80 } | 86 } |
81 | 87 |
82 } // namespace gfx | 88 } // namespace gfx |
OLD | NEW |