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 #ifndef UI_GFX_GL_GL_SURFACE_ANDROID_H_ | 5 #ifndef UI_GL_GL_SURFACE_ANDROID_H_ |
6 #define UI_GFX_GL_GL_SURFACE_ANDROID_H_ | 6 #define UI_GL_GL_SURFACE_ANDROID_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "ui/gfx/gl/gl_surface_egl.h" | 10 #include "ui/gl/gl_surface_egl.h" |
11 | 11 |
12 namespace gfx { | 12 namespace gfx { |
13 | 13 |
14 // A view surface. This can be created in the GPU process (default case), or | 14 // A view surface. This can be created in the GPU process (default case), or |
15 // browser process (in-process-gpu), or render process (in-process-webgl). When | 15 // browser process (in-process-gpu), or render process (in-process-webgl). When |
16 // it is initialized, it always uses a pbuffer EGL surface until the native view | 16 // it is initialized, it always uses a pbuffer EGL surface until the native view |
17 // is set. The native view is in charge of sharing the GL texture with UI thread | 17 // is set. The native view is in charge of sharing the GL texture with UI thread |
18 // in the browser process through SurfaceTexture. | 18 // in the browser process through SurfaceTexture. |
19 class AndroidViewSurface : public NativeViewGLSurfaceEGL { | 19 class AndroidViewSurface : public NativeViewGLSurfaceEGL { |
20 public: | 20 public: |
21 AndroidViewSurface(); | 21 AndroidViewSurface(); |
22 virtual ~AndroidViewSurface(); | 22 virtual ~AndroidViewSurface(); |
23 | 23 |
24 // Implement GLSurface. | 24 // Implement GLSurface. |
25 virtual bool Initialize() OVERRIDE; | 25 virtual bool Initialize() OVERRIDE; |
26 virtual void Destroy() OVERRIDE; | 26 virtual void Destroy() OVERRIDE; |
27 virtual bool Resize(const gfx::Size& size) OVERRIDE; | 27 virtual bool Resize(const gfx::Size& size) OVERRIDE; |
28 virtual bool IsOffscreen() OVERRIDE; | 28 virtual bool IsOffscreen() OVERRIDE; |
29 virtual bool SwapBuffers() OVERRIDE; | 29 virtual bool SwapBuffers() OVERRIDE; |
30 virtual gfx::Size GetSize() OVERRIDE; | 30 virtual gfx::Size GetSize() OVERRIDE; |
31 virtual EGLSurface GetHandle() OVERRIDE; | 31 virtual EGLSurface GetHandle() OVERRIDE; |
32 virtual void SetNativeWindow(AndroidNativeWindow* window) OVERRIDE; | 32 virtual void SetNativeWindow(AndroidNativeWindow* window) OVERRIDE; |
33 | 33 |
34 private: | 34 private: |
35 bool CreateWindowSurface(AndroidNativeWindow* window); | 35 bool CreateWindowSurface(AndroidNativeWindow* window); |
| 36 |
36 scoped_refptr<PbufferGLSurfaceEGL> pbuffer_surface_; | 37 scoped_refptr<PbufferGLSurfaceEGL> pbuffer_surface_; |
37 AndroidNativeWindow* window_; | 38 AndroidNativeWindow* window_; |
38 | 39 |
39 DISALLOW_COPY_AND_ASSIGN(AndroidViewSurface); | 40 DISALLOW_COPY_AND_ASSIGN(AndroidViewSurface); |
40 }; | 41 }; |
41 | 42 |
42 } // namespace gfx | 43 } // namespace gfx |
43 | 44 |
44 #endif /* UI_GFX_GL_GL_SURFACE_ANDROID_H_ */ | 45 #endif // UI_GL_GL_SURFACE_ANDROID_H_ |
OLD | NEW |