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" |
(...skipping 10 matching lines...) Expand all Loading... |
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 bool Initialize(GLSurface* compatible_surface, | 29 bool Initialize(GLSurface* compatible_surface, |
30 GpuPreference gpu_preference) override; | 30 GpuPreference gpu_preference) override; |
31 void Destroy() override {} | |
32 bool MakeCurrent(GLSurface* surface) override; | 31 bool MakeCurrent(GLSurface* surface) override; |
33 void ReleaseCurrent(GLSurface* surface) override {} | 32 void ReleaseCurrent(GLSurface* surface) override {} |
34 bool IsCurrent(GLSurface* surface) override { return true; } | 33 bool IsCurrent(GLSurface* surface) override { return true; } |
35 void* GetHandle() override { return nullptr; } | 34 void* GetHandle() override { return nullptr; } |
36 void OnSetSwapInterval(int interval) override {} | 35 void OnSetSwapInterval(int interval) override {} |
37 std::string GetExtensions() override; | 36 std::string GetExtensions() override; |
38 | 37 |
39 protected: | 38 protected: |
40 ~GLNonOwnedContext() override {} | 39 ~GLNonOwnedContext() override {} |
41 | 40 |
42 private: | 41 private: |
| 42 EGLDisplay display_; |
| 43 |
43 DISALLOW_COPY_AND_ASSIGN(GLNonOwnedContext); | 44 DISALLOW_COPY_AND_ASSIGN(GLNonOwnedContext); |
44 | |
45 EGLDisplay display_; | |
46 }; | 45 }; |
47 | 46 |
48 GLNonOwnedContext::GLNonOwnedContext(GLShareGroup* share_group) | 47 GLNonOwnedContext::GLNonOwnedContext(GLShareGroup* share_group) |
49 : GLContextReal(share_group), display_(nullptr) {} | 48 : GLContextReal(share_group), display_(nullptr) {} |
50 | 49 |
51 bool GLNonOwnedContext::Initialize(GLSurface* compatible_surface, | 50 bool GLNonOwnedContext::Initialize(GLSurface* compatible_surface, |
52 GpuPreference gpu_preference) { | 51 GpuPreference gpu_preference) { |
53 display_ = eglGetDisplay(EGL_DEFAULT_DISPLAY); | 52 display_ = eglGetDisplay(EGL_DEFAULT_DISPLAY); |
54 return true; | 53 return true; |
55 } | 54 } |
(...skipping 86 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. | 141 // above. Low-end devices use 4444 textures so we can use a lower limit. |
143 limit_bytes = 8; | 142 limit_bytes = 8; |
144 } | 143 } |
145 limit_bytes = limit_bytes * 1024 * 1024; | 144 limit_bytes = limit_bytes * 1024 * 1024; |
146 } | 145 } |
147 *bytes = limit_bytes; | 146 *bytes = limit_bytes; |
148 return true; | 147 return true; |
149 } | 148 } |
150 | 149 |
151 } | 150 } |
OLD | NEW |