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/impl/file_surface_factory_ozone.h" | 10 #include "ui/gfx/ozone/impl/file_surface_factory_ozone.h" |
(...skipping 28 matching lines...) Expand all Loading... | |
39 } | 39 } |
40 }; | 40 }; |
41 | 41 |
42 SurfaceFactoryOzone::SurfaceFactoryOzone() { | 42 SurfaceFactoryOzone::SurfaceFactoryOzone() { |
43 } | 43 } |
44 | 44 |
45 SurfaceFactoryOzone::~SurfaceFactoryOzone() { | 45 SurfaceFactoryOzone::~SurfaceFactoryOzone() { |
46 } | 46 } |
47 | 47 |
48 SurfaceFactoryOzone* SurfaceFactoryOzone::GetInstance() { | 48 SurfaceFactoryOzone* SurfaceFactoryOzone::GetInstance() { |
49 if (!impl_) { | 49 CHECK(impl_) << "No SurfaceFactoryOzone implementation set."; |
50 const char kOzoneFileSurface[] = "ozone-dump-file"; | |
51 CommandLine* cmd = CommandLine::ForCurrentProcess(); | |
52 if (cmd->HasSwitch(kOzoneFileSurface)) { | |
53 base::FilePath location = cmd->GetSwitchValuePath(kOzoneFileSurface); | |
54 if (location.empty()) | |
55 location = base::FilePath("/dev/null"); | |
56 impl_ = new FileSurfaceFactoryOzone(location); | |
57 } else { | |
58 LOG(WARNING) << "No SurfaceFactoryOzone implementation set. Using default" | |
59 " gfx::SoftwareSurfaceFactoryOzone."; | |
60 impl_ = new SoftwareSurfaceFactoryOzone(); | |
61 } | |
62 } | |
63 return impl_; | 50 return impl_; |
64 } | 51 } |
65 | 52 |
66 void SurfaceFactoryOzone::SetInstance(SurfaceFactoryOzone* impl) { | 53 void SurfaceFactoryOzone::SetInstance(SurfaceFactoryOzone* impl) { |
67 impl_ = impl; | 54 impl_ = impl; |
68 } | 55 } |
69 | 56 |
70 const char* SurfaceFactoryOzone::DefaultDisplaySpec() { | 57 const char* SurfaceFactoryOzone::DefaultDisplaySpec() { |
71 char* envvar = getenv("ASH_DISPLAY_SPEC"); | 58 char* envvar = getenv("ASH_DISPLAY_SPEC"); |
vignatti (out of this project)
2013/10/28 15:26:44
I'm not sure we want to use this CL for fixing it,
spang
2013/10/28 15:42:30
I agree this probably doesn't belong, but not for
| |
72 if (envvar) | 59 if (envvar) |
73 return envvar; | 60 return envvar; |
74 return "720x1280*2"; | 61 return "720x1280*2"; |
75 } | 62 } |
76 | 63 |
77 gfx::Screen* SurfaceFactoryOzone::CreateDesktopScreen() { | 64 gfx::Screen* SurfaceFactoryOzone::CreateDesktopScreen() { |
78 return NULL; | 65 return NULL; |
79 } | 66 } |
80 | 67 |
81 intptr_t SurfaceFactoryOzone::GetNativeDisplay() { | 68 intptr_t SurfaceFactoryOzone::GetNativeDisplay() { |
(...skipping 12 matching lines...) Expand all Loading... | |
94 const int32* desired_attributes) { | 81 const int32* desired_attributes) { |
95 return desired_attributes; | 82 return desired_attributes; |
96 } | 83 } |
97 | 84 |
98 // static | 85 // static |
99 SurfaceFactoryOzone* SurfaceFactoryOzone::CreateTestHelper() { | 86 SurfaceFactoryOzone* SurfaceFactoryOzone::CreateTestHelper() { |
100 return new SurfaceFactoryOzoneStub; | 87 return new SurfaceFactoryOzoneStub; |
101 } | 88 } |
102 | 89 |
103 } // namespace gfx | 90 } // namespace gfx |
OLD | NEW |