Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Side by Side Diff: ui/gl/gl_surface_win.cc

Issue 2024953002: Move GL one-off initialization code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split_x11
Patch Set: Delete GLInitializer class. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gl/gl_surface_ozone.cc ('k') | ui/gl/gl_surface_x11.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <dwmapi.h> 7 #include <dwmapi.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 private: 47 private:
48 ~NativeViewGLSurfaceOSMesa() override; 48 ~NativeViewGLSurfaceOSMesa() override;
49 49
50 gfx::AcceleratedWidget window_; 50 gfx::AcceleratedWidget window_;
51 HDC device_context_; 51 HDC device_context_;
52 52
53 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceOSMesa); 53 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceOSMesa);
54 }; 54 };
55 55
56 // Helper routine that does one-off initialization like determining the
57 // pixel format.
58 bool GLSurface::InitializeOneOffInternal() {
59 VSyncProviderWin::InitializeOneOff();
60
61 switch (GetGLImplementation()) {
62 case kGLImplementationDesktopGL:
63 if (!GLSurfaceWGL::InitializeOneOff()) {
64 LOG(ERROR) << "GLSurfaceWGL::InitializeOneOff failed.";
65 return false;
66 }
67 break;
68 case kGLImplementationEGLGLES2:
69 if (!GLSurfaceEGL::InitializeOneOff()) {
70 LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed.";
71 return false;
72 }
73 break;
74 case kGLImplementationNone:
75 case kGLImplementationDesktopGLCoreProfile:
76 case kGLImplementationAppleGL:
77 NOTREACHED();
78 case kGLImplementationOSMesaGL:
79 case kGLImplementationMockGL:
80 break;
81 }
82 return true;
83 }
84
85 NativeViewGLSurfaceOSMesa::NativeViewGLSurfaceOSMesa( 56 NativeViewGLSurfaceOSMesa::NativeViewGLSurfaceOSMesa(
86 gfx::AcceleratedWidget window) 57 gfx::AcceleratedWidget window)
87 : GLSurfaceOSMesa(SURFACE_OSMESA_RGBA, gfx::Size(1, 1)), 58 : GLSurfaceOSMesa(SURFACE_OSMESA_RGBA, gfx::Size(1, 1)),
88 window_(window), 59 window_(window),
89 device_context_(NULL) { 60 device_context_(NULL) {
90 DCHECK(window); 61 DCHECK(window);
91 } 62 }
92 63
93 NativeViewGLSurfaceOSMesa::~NativeViewGLSurfaceOSMesa() { 64 NativeViewGLSurfaceOSMesa::~NativeViewGLSurfaceOSMesa() {
94 Destroy(); 65 Destroy();
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 NOTREACHED(); 236 NOTREACHED();
266 return NULL; 237 return NULL;
267 } 238 }
268 } 239 }
269 240
270 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { 241 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() {
271 return GetDC(NULL); 242 return GetDC(NULL);
272 } 243 }
273 244
274 } // namespace gl 245 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_ozone.cc ('k') | ui/gl/gl_surface_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698