| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |