OLD | NEW |
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/gl/gl_surface.h" | 5 #include "ui/gl/gl_surface.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
10 #include "ui/gfx/ozone/surface_factory_ozone.h" | 10 #include "ui/gfx/ozone/surface_factory_ozone.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 if (gfx::SurfaceFactoryOzone::GetInstance()->InitializeHardware() != | 22 if (gfx::SurfaceFactoryOzone::GetInstance()->InitializeHardware() != |
23 gfx::SurfaceFactoryOzone::INITIALIZED) { | 23 gfx::SurfaceFactoryOzone::INITIALIZED) { |
24 LOG(ERROR) << "Ozone failed to initialize hardware"; | 24 LOG(ERROR) << "Ozone failed to initialize hardware"; |
25 return false; | 25 return false; |
26 } | 26 } |
27 | 27 |
28 if (!GLSurfaceEGL::InitializeOneOff()) { | 28 if (!GLSurfaceEGL::InitializeOneOff()) { |
29 LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed."; | 29 LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed."; |
30 return false; | 30 return false; |
31 } | 31 } |
| 32 |
| 33 return true; |
| 34 case kGLImplementationOSMesaGL: |
| 35 case kGLImplementationMockGL: |
| 36 return true; |
32 default: | 37 default: |
33 break; | 38 return false; |
34 } | 39 } |
35 return true; | |
36 } | 40 } |
37 | 41 |
38 // static | 42 // static |
39 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( | 43 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( |
40 gfx::AcceleratedWidget window) { | 44 gfx::AcceleratedWidget window) { |
41 if (GetGLImplementation() == kGLImplementationOSMesaGL) { | 45 if (GetGLImplementation() == kGLImplementationOSMesaGL) { |
42 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesaHeadless()); | 46 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesaHeadless()); |
43 if (!surface->Initialize()) | 47 if (!surface->Initialize()) |
44 return NULL; | 48 return NULL; |
45 return surface; | 49 return surface; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 NOTREACHED(); | 95 NOTREACHED(); |
92 return NULL; | 96 return NULL; |
93 } | 97 } |
94 } | 98 } |
95 | 99 |
96 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 100 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
97 return SurfaceFactoryOzone::GetInstance()->GetNativeDisplay(); | 101 return SurfaceFactoryOzone::GetInstance()->GetNativeDisplay(); |
98 } | 102 } |
99 | 103 |
100 } // namespace gfx | 104 } // namespace gfx |
OLD | NEW |