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

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

Issue 320283002: Fix crash when using surfaceless EGL on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Fix Mac build issue Created 6 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 | « android_webview/browser/aw_gl_surface.cc ('k') | ui/gl/gl_surface.h » ('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_context.h" 5 #include "ui/gl/gl_context.h"
6 6
7 #include "base/android/sys_utils.h" 7 #include "base/android/sys_utils.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/sys_info.h" 10 #include "base/sys_info.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 GLSurface* compatible_surface, 77 GLSurface* compatible_surface,
78 GpuPreference gpu_preference) { 78 GpuPreference gpu_preference) {
79 scoped_refptr<GLContext> context; 79 scoped_refptr<GLContext> context;
80 switch (GetGLImplementation()) { 80 switch (GetGLImplementation()) {
81 case kGLImplementationMockGL: 81 case kGLImplementationMockGL:
82 return scoped_refptr<GLContext>(new GLContextStub()); 82 return scoped_refptr<GLContext>(new GLContextStub());
83 case kGLImplementationOSMesaGL: 83 case kGLImplementationOSMesaGL:
84 context = new GLContextOSMesa(share_group); 84 context = new GLContextOSMesa(share_group);
85 break; 85 break;
86 default: 86 default:
87 if (compatible_surface->GetHandle()) 87 if (compatible_surface->RepresentsNonOwnedSurface())
88 context = new GLNonOwnedContext(share_group);
89 else
88 context = new GLContextEGL(share_group); 90 context = new GLContextEGL(share_group);
89 else
90 context = new GLNonOwnedContext(share_group);
91 break; 91 break;
92 } 92 }
93 93
94 if (!context->Initialize(compatible_surface, gpu_preference)) 94 if (!context->Initialize(compatible_surface, gpu_preference))
95 return NULL; 95 return NULL;
96 96
97 return context; 97 return context;
98 } 98 }
99 99
100 bool GLContextEGL::GetTotalGpuMemory(size_t* bytes) { 100 bool GLContextEGL::GetTotalGpuMemory(size_t* bytes) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // increased the limit to 12 (8MB, or 12MB in emergencies). 145 // increased the limit to 12 (8MB, or 12MB in emergencies).
146 limit_bytes = 12; 146 limit_bytes = 12;
147 } 147 }
148 limit_bytes = limit_bytes * 1024 * 1024; 148 limit_bytes = limit_bytes * 1024 * 1024;
149 } 149 }
150 *bytes = limit_bytes; 150 *bytes = limit_bytes;
151 return true; 151 return true;
152 } 152 }
153 153
154 } 154 }
OLDNEW
« no previous file with comments | « android_webview/browser/aw_gl_surface.cc ('k') | ui/gl/gl_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698