| 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
| 10 #include "ui/gl/gl_bindings.h" | 10 #include "ui/gl/gl_bindings.h" |
| 11 #include "ui/gl/gl_context_egl.h" | 11 #include "ui/gl/gl_context_egl.h" |
| 12 #include "ui/gl/gl_context_stub.h" | 12 #include "ui/gl/gl_context_stub.h" |
| 13 #include "ui/gl/gl_implementation.h" | 13 #include "ui/gl/gl_implementation.h" |
| 14 #include "ui/gl/gl_surface.h" | 14 #include "ui/gl/gl_surface.h" |
| 15 | 15 |
| 16 namespace gfx { | 16 namespace gfx { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 // Used to render into an already current context+surface, | 20 // Used to render into an already current context+surface, |
| 21 // that we do not have ownership of (draw callback). | 21 // that we do not have ownership of (draw callback). |
| 22 class GLNonOwnedContext : public GLContext { | 22 class GLNonOwnedContext : public GLContextReal { |
| 23 public: | 23 public: |
| 24 GLNonOwnedContext(GLShareGroup* share_group); | 24 GLNonOwnedContext(GLShareGroup* share_group); |
| 25 | 25 |
| 26 // Implement GLContext. | 26 // Implement GLContext. |
| 27 virtual bool Initialize(GLSurface* compatible_surface, | 27 virtual bool Initialize(GLSurface* compatible_surface, |
| 28 GpuPreference gpu_preference) OVERRIDE { | 28 GpuPreference gpu_preference) OVERRIDE { |
| 29 return true; | 29 return true; |
| 30 } | 30 } |
| 31 virtual void Destroy() OVERRIDE {} | 31 virtual void Destroy() OVERRIDE {} |
| 32 virtual bool MakeCurrent(GLSurface* surface) OVERRIDE; | 32 virtual bool MakeCurrent(GLSurface* surface) OVERRIDE; |
| 33 virtual void ReleaseCurrent(GLSurface* surface) OVERRIDE {} | 33 virtual void ReleaseCurrent(GLSurface* surface) OVERRIDE {} |
| 34 virtual bool IsCurrent(GLSurface* surface) OVERRIDE { return true; } | 34 virtual bool IsCurrent(GLSurface* surface) OVERRIDE { return true; } |
| 35 virtual void* GetHandle() OVERRIDE { return NULL; } | 35 virtual void* GetHandle() OVERRIDE { return NULL; } |
| 36 virtual void SetSwapInterval(int interval) OVERRIDE {} | 36 virtual void SetSwapInterval(int interval) OVERRIDE {} |
| 37 virtual std::string GetExtensions() OVERRIDE; | 37 virtual std::string GetExtensions() OVERRIDE; |
| 38 | 38 |
| 39 protected: | 39 protected: |
| 40 virtual ~GLNonOwnedContext() {} | 40 virtual ~GLNonOwnedContext() {} |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 DISALLOW_COPY_AND_ASSIGN(GLNonOwnedContext); | 43 DISALLOW_COPY_AND_ASSIGN(GLNonOwnedContext); |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 GLNonOwnedContext::GLNonOwnedContext(GLShareGroup* share_group) | 46 GLNonOwnedContext::GLNonOwnedContext(GLShareGroup* share_group) |
| 47 : GLContext(share_group) {} | 47 : GLContextReal(share_group) {} |
| 48 | 48 |
| 49 bool GLNonOwnedContext::MakeCurrent(GLSurface* surface) { | 49 bool GLNonOwnedContext::MakeCurrent(GLSurface* surface) { |
| 50 SetCurrent(this, surface); | 50 SetCurrent(surface); |
| 51 SetRealGLApi(); | 51 SetRealGLApi(); |
| 52 return true; | 52 return true; |
| 53 } | 53 } |
| 54 | 54 |
| 55 std::string GLNonOwnedContext::GetExtensions() { | 55 std::string GLNonOwnedContext::GetExtensions() { |
| 56 return GLContext::GetExtensions(); | 56 return GLContext::GetExtensions(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // anonymous namespace | 59 } // anonymous namespace |
| 60 | 60 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 limit = heap_size / 2; | 106 limit = heap_size / 2; |
| 107 else | 107 else |
| 108 limit = (heap_size + (heap_growth * 2)) / 4; | 108 limit = (heap_size + (heap_growth * 2)) / 4; |
| 109 dalvik_limit = limit * 1024 * 1024; | 109 dalvik_limit = limit * 1024 * 1024; |
| 110 } | 110 } |
| 111 *bytes = dalvik_limit; | 111 *bytes = dalvik_limit; |
| 112 return true; | 112 return true; |
| 113 } | 113 } |
| 114 | 114 |
| 115 } | 115 } |
| OLD | NEW |