| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 // static | 73 // static |
| 74 scoped_refptr<GLContext> GLContext::CreateGLContext( | 74 scoped_refptr<GLContext> GLContext::CreateGLContext( |
| 75 GLShareGroup* share_group, | 75 GLShareGroup* share_group, |
| 76 GLSurface* compatible_surface, | 76 GLSurface* compatible_surface, |
| 77 GpuPreference gpu_preference) { | 77 GpuPreference gpu_preference) { |
| 78 if (GetGLImplementation() == kGLImplementationMockGL) | 78 if (GetGLImplementation() == kGLImplementationMockGL) |
| 79 return scoped_refptr<GLContext>(new GLContextStub()); | 79 return scoped_refptr<GLContext>(new GLContextStub()); |
| 80 | 80 |
| 81 scoped_refptr<GLContext> context; | 81 scoped_refptr<GLContext> context; |
| 82 if (compatible_surface->GetHandle()) | 82 /* |
| 83 if (compatible_surface->GetHandle()) { |
| 84 LOG(ERROR) << "------------------------- GLContextEGL"; |
| 83 context = new GLContextEGL(share_group); | 85 context = new GLContextEGL(share_group); |
| 84 else | 86 } else { |
| 87 LOG(ERROR) << "------------------------- GLNonOwnedContext"; |
| 88 */ |
| 85 context = new GLNonOwnedContext(share_group); | 89 context = new GLNonOwnedContext(share_group); |
| 90 // } |
| 86 if (!context->Initialize(compatible_surface, gpu_preference)) | 91 if (!context->Initialize(compatible_surface, gpu_preference)) |
| 87 return NULL; | 92 return NULL; |
| 88 return context; | 93 return context; |
| 89 } | 94 } |
| 90 | 95 |
| 91 bool GLContextEGL::GetTotalGpuMemory(size_t* bytes) { | 96 bool GLContextEGL::GetTotalGpuMemory(size_t* bytes) { |
| 92 DCHECK(bytes); | 97 DCHECK(bytes); |
| 93 *bytes = 0; | 98 *bytes = 0; |
| 94 | 99 |
| 95 // We can't query available GPU memory from the system on Android. | 100 // We can't query available GPU memory from the system on Android. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // above. Low-end devices use 4444 textures so we can use a lower limit. | 135 // above. Low-end devices use 4444 textures so we can use a lower limit. |
| 131 limit_bytes = 8; | 136 limit_bytes = 8; |
| 132 } | 137 } |
| 133 limit_bytes = limit_bytes * 1024 * 1024; | 138 limit_bytes = limit_bytes * 1024 * 1024; |
| 134 } | 139 } |
| 135 *bytes = limit_bytes; | 140 *bytes = limit_bytes; |
| 136 return true; | 141 return true; |
| 137 } | 142 } |
| 138 | 143 |
| 139 } | 144 } |
| OLD | NEW |