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

Side by Side Diff: ui/gl/gl_surface_ozone.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_mac.cc ('k') | ui/gl/gl_surface_win.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 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 scoped_refptr<GLSurface> surface = new GLSurfaceOzoneSurfacelessSurfaceImpl( 678 scoped_refptr<GLSurface> surface = new GLSurfaceOzoneSurfacelessSurfaceImpl(
679 std::move(surface_ozone), window); 679 std::move(surface_ozone), window);
680 if (!surface->Initialize()) 680 if (!surface->Initialize())
681 return nullptr; 681 return nullptr;
682 return surface; 682 return surface;
683 } 683 }
684 684
685 } // namespace 685 } // namespace
686 686
687 // static 687 // static
688 bool GLSurface::InitializeOneOffInternal() {
689 switch (GetGLImplementation()) {
690 case kGLImplementationEGLGLES2:
691 if (!GLSurfaceEGL::InitializeOneOff()) {
692 LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed.";
693 return false;
694 }
695
696 return true;
697 case kGLImplementationOSMesaGL:
698 case kGLImplementationMockGL:
699 return true;
700 default:
701 return false;
702 }
703 }
704
705 // static
706 scoped_refptr<GLSurface> GLSurface::CreateSurfacelessViewGLSurface( 688 scoped_refptr<GLSurface> GLSurface::CreateSurfacelessViewGLSurface(
707 gfx::AcceleratedWidget window) { 689 gfx::AcceleratedWidget window) {
708 if (GetGLImplementation() == kGLImplementationEGLGLES2 && 690 if (GetGLImplementation() == kGLImplementationEGLGLES2 &&
709 window != gfx::kNullAcceleratedWidget && 691 window != gfx::kNullAcceleratedWidget &&
710 GLSurfaceEGL::IsEGLSurfacelessContextSupported()) { 692 GLSurfaceEGL::IsEGLSurfacelessContextSupported()) {
711 std::unique_ptr<ui::SurfaceOzoneEGL> surface_ozone = 693 std::unique_ptr<ui::SurfaceOzoneEGL> surface_ozone =
712 ui::OzonePlatform::GetInstance() 694 ui::OzonePlatform::GetInstance()
713 ->GetSurfaceFactoryOzone() 695 ->GetSurfaceFactoryOzone()
714 ->CreateSurfacelessEGLSurfaceForWidget(window); 696 ->CreateSurfacelessEGLSurfaceForWidget(window);
715 if (!surface_ozone) 697 if (!surface_ozone)
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 } 764 }
783 } 765 }
784 766
785 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { 767 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() {
786 return ui::OzonePlatform::GetInstance() 768 return ui::OzonePlatform::GetInstance()
787 ->GetSurfaceFactoryOzone() 769 ->GetSurfaceFactoryOzone()
788 ->GetNativeDisplay(); 770 ->GetNativeDisplay();
789 } 771 }
790 772
791 } // namespace gl 773 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_mac.cc ('k') | ui/gl/gl_surface_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698