| 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_osmesa.h" | 12 #include "ui/gl/gl_context_osmesa.h" |
| 13 #include "ui/gl/gl_context_stub.h" | 13 #include "ui/gl/gl_context_stub.h" |
| 14 #include "ui/gl/gl_implementation.h" | 14 #include "ui/gl/gl_implementation.h" |
| 15 #include "ui/gl/gl_surface.h" | 15 #include "ui/gl/gl_surface.h" |
| 16 | 16 |
| 17 namespace gfx { | 17 namespace gfx { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 // Used to render into an already current context+surface, | 21 // Used to render into an already current context+surface, |
| 22 // that we do not have ownership of (draw callback). | 22 // that we do not have ownership of (draw callback). |
| 23 // TODO(boliu): Make this inherit from GLContextEGL. | 23 // TODO(boliu): Make this inherit from GLContextEGL. |
| 24 class GLNonOwnedContext : public GLContextReal { | 24 class GLNonOwnedContext : public GLContextReal { |
| 25 public: | 25 public: |
| 26 GLNonOwnedContext(GLShareGroup* share_group); | 26 GLNonOwnedContext(GLShareGroup* share_group); |
| 27 | 27 |
| 28 // Implement GLContext. | 28 // Implement GLContext. |
| 29 virtual bool Initialize(GLSurface* compatible_surface, | 29 bool Initialize(GLSurface* compatible_surface, |
| 30 GpuPreference gpu_preference) override; | 30 GpuPreference gpu_preference) override; |
| 31 virtual void Destroy() override {} | 31 void Destroy() override {} |
| 32 virtual bool MakeCurrent(GLSurface* surface) override; | 32 bool MakeCurrent(GLSurface* surface) override; |
| 33 virtual void ReleaseCurrent(GLSurface* surface) override {} | 33 void ReleaseCurrent(GLSurface* surface) override {} |
| 34 virtual bool IsCurrent(GLSurface* surface) override { return true; } | 34 bool IsCurrent(GLSurface* surface) override { return true; } |
| 35 virtual void* GetHandle() override { return NULL; } | 35 void* GetHandle() override { return NULL; } |
| 36 virtual void OnSetSwapInterval(int interval) override {} | 36 void OnSetSwapInterval(int interval) override {} |
| 37 virtual std::string GetExtensions() override; | 37 std::string GetExtensions() override; |
| 38 | 38 |
| 39 protected: | 39 protected: |
| 40 virtual ~GLNonOwnedContext() {} | 40 ~GLNonOwnedContext() override {} |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 DISALLOW_COPY_AND_ASSIGN(GLNonOwnedContext); | 43 DISALLOW_COPY_AND_ASSIGN(GLNonOwnedContext); |
| 44 | 44 |
| 45 EGLDisplay display_; | 45 EGLDisplay display_; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 GLNonOwnedContext::GLNonOwnedContext(GLShareGroup* share_group) | 48 GLNonOwnedContext::GLNonOwnedContext(GLShareGroup* share_group) |
| 49 : GLContextReal(share_group), display_(NULL) {} | 49 : GLContextReal(share_group), display_(NULL) {} |
| 50 | 50 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // above. Low-end devices use 4444 textures so we can use a lower limit. | 142 // above. Low-end devices use 4444 textures so we can use a lower limit. |
| 143 limit_bytes = 8; | 143 limit_bytes = 8; |
| 144 } | 144 } |
| 145 limit_bytes = limit_bytes * 1024 * 1024; | 145 limit_bytes = limit_bytes * 1024 * 1024; |
| 146 } | 146 } |
| 147 *bytes = limit_bytes; | 147 *bytes = limit_bytes; |
| 148 return true; | 148 return true; |
| 149 } | 149 } |
| 150 | 150 |
| 151 } | 151 } |
| OLD | NEW |