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_GL_GL_SURFACE_ANDROID_H_ | 5 #ifndef UI_GL_GL_SURFACE_ANDROID_H_ |
6 #define UI_GL_GL_SURFACE_ANDROID_H_ | 6 #define UI_GL_GL_SURFACE_ANDROID_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "ui/base/ui_export.h" |
9 #include "ui/gl/gl_surface_egl.h" | 10 #include "ui/gl/gl_surface_egl.h" |
10 | 11 |
11 namespace gfx { | 12 namespace gfx { |
12 | 13 |
13 // 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 |
14 // 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 |
15 // 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 |
16 // 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 |
17 // in the browser process through SurfaceTexture. | 18 // in the browser process through SurfaceTexture. |
18 class AndroidViewSurface : public NativeViewGLSurfaceEGL { | 19 class GL_EXPORT AndroidViewSurface : public NativeViewGLSurfaceEGL { |
19 public: | 20 public: |
20 AndroidViewSurface(); | 21 AndroidViewSurface(); |
21 | 22 |
22 // Implement GLSurface. | 23 // Implement GLSurface. |
23 virtual bool Initialize() OVERRIDE; | 24 virtual bool Initialize() OVERRIDE; |
24 virtual void Destroy() OVERRIDE; | 25 virtual void Destroy() OVERRIDE; |
25 virtual bool Resize(const gfx::Size& size) OVERRIDE; | 26 virtual bool Resize(const gfx::Size& size) OVERRIDE; |
26 virtual bool IsOffscreen() OVERRIDE; | 27 virtual bool IsOffscreen() OVERRIDE; |
27 virtual bool SwapBuffers() OVERRIDE; | 28 virtual bool SwapBuffers() OVERRIDE; |
28 virtual gfx::Size GetSize() OVERRIDE; | 29 virtual gfx::Size GetSize() OVERRIDE; |
29 virtual EGLSurface GetHandle() OVERRIDE; | 30 virtual EGLSurface GetHandle() OVERRIDE; |
30 virtual void SetNativeWindow(AndroidNativeWindow* window) OVERRIDE; | 31 virtual void SetNativeWindow(AndroidNativeWindow* window) OVERRIDE; |
31 | 32 |
32 private: | 33 private: |
33 virtual ~AndroidViewSurface(); | 34 virtual ~AndroidViewSurface(); |
34 | 35 |
35 bool CreateWindowSurface(AndroidNativeWindow* window); | 36 bool CreateWindowSurface(AndroidNativeWindow* window); |
36 | 37 |
37 scoped_refptr<PbufferGLSurfaceEGL> pbuffer_surface_; | 38 scoped_refptr<PbufferGLSurfaceEGL> pbuffer_surface_; |
38 AndroidNativeWindow* window_; | 39 AndroidNativeWindow* window_; |
39 | 40 |
40 DISALLOW_COPY_AND_ASSIGN(AndroidViewSurface); | 41 DISALLOW_COPY_AND_ASSIGN(AndroidViewSurface); |
41 }; | 42 }; |
42 | 43 |
43 } // namespace gfx | 44 } // namespace gfx |
44 | 45 |
45 #endif // UI_GL_GL_SURFACE_ANDROID_H_ | 46 #endif // UI_GL_GL_SURFACE_ANDROID_H_ |
OLD | NEW |