OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_OZONE_PUBLIC_SURFACE_OZONE_EGL_H_ | 5 #ifndef UI_OZONE_PUBLIC_SURFACE_OZONE_EGL_H_ |
6 #define UI_OZONE_PUBLIC_SURFACE_OZONE_EGL_H_ | 6 #define UI_OZONE_PUBLIC_SURFACE_OZONE_EGL_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "ui/gfx/overlay_transform.h" | 11 #include "ui/gfx/overlay_transform.h" |
12 #include "ui/gfx/swap_result.h" | |
13 #include "ui/ozone/ozone_base_export.h" | 12 #include "ui/ozone/ozone_base_export.h" |
14 | 13 |
15 namespace gfx { | 14 namespace gfx { |
16 class Size; | 15 class Size; |
17 class VSyncProvider; | 16 class VSyncProvider; |
18 } | 17 } |
19 | 18 |
20 namespace ui { | 19 namespace ui { |
21 class NativePixmap; | 20 class NativePixmap; |
22 | 21 |
23 typedef base::Callback<void(gfx::SwapResult)> SwapCompletionCallback; | |
24 | |
25 // The platform-specific part of an EGL surface. | 22 // The platform-specific part of an EGL surface. |
26 // | 23 // |
27 // This class owns any bits that the ozone implementation needs freed when | 24 // This class owns any bits that the ozone implementation needs freed when |
28 // the EGL surface is destroyed. | 25 // the EGL surface is destroyed. |
29 class OZONE_BASE_EXPORT SurfaceOzoneEGL { | 26 class OZONE_BASE_EXPORT SurfaceOzoneEGL { |
30 public: | 27 public: |
31 virtual ~SurfaceOzoneEGL() {} | 28 virtual ~SurfaceOzoneEGL() {} |
32 | 29 |
33 // Returns the EGL native window for rendering onto this surface. | 30 // Returns the EGL native window for rendering onto this surface. |
34 // This can be used to to create a GLSurface. | 31 // This can be used to to create a GLSurface. |
35 virtual intptr_t /* EGLNativeWindowType */ GetNativeWindow() = 0; | 32 virtual intptr_t /* EGLNativeWindowType */ GetNativeWindow() = 0; |
36 | 33 |
37 // Attempts to resize the EGL native window to match the viewport | 34 // Attempts to resize the EGL native window to match the viewport |
38 // size. | 35 // size. |
39 virtual bool ResizeNativeWindow(const gfx::Size& viewport_size) = 0; | 36 virtual bool ResizeNativeWindow(const gfx::Size& viewport_size) = 0; |
40 | 37 |
41 // Called after we swap buffers. This is usually a no-op but can | 38 // Called after we swap buffers. This is usually a no-op but can |
42 // be used to present the new front buffer if the platform requires this. | 39 // be used to present the new front buffer if the platform requires this. |
43 virtual bool OnSwapBuffers() = 0; | 40 virtual bool OnSwapBuffers() = 0; |
44 | 41 |
| 42 typedef base::Closure SwapCompletionCallback; |
45 // Called after we swap buffers. This is usually a no-op but can | 43 // Called after we swap buffers. This is usually a no-op but can |
46 // be used to present the new front buffer if the platform requires this. | 44 // be used to present the new front buffer if the platform requires this. |
47 // The callback should be run on the calling thread | 45 // The callback should be run on the calling thread |
48 // (i.e. same thread SwapBuffersAsync is called). | 46 // (i.e. same thread SwapBuffersAsync is called). |
49 virtual bool OnSwapBuffersAsync(const SwapCompletionCallback& callback) = 0; | 47 virtual bool OnSwapBuffersAsync(const SwapCompletionCallback& callback) = 0; |
50 | 48 |
51 // Returns a gfx::VsyncProvider for this surface. Note that this may be | 49 // Returns a gfx::VsyncProvider for this surface. Note that this may be |
52 // called after we have entered the sandbox so if there are operations (e.g. | 50 // called after we have entered the sandbox so if there are operations (e.g. |
53 // opening a file descriptor providing vsync events) that must be done | 51 // opening a file descriptor providing vsync events) that must be done |
54 // outside of the sandbox, they must have been completed in | 52 // outside of the sandbox, they must have been completed in |
55 // InitializeHardware. Returns an empty scoped_ptr on error. | 53 // InitializeHardware. Returns an empty scoped_ptr on error. |
56 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() = 0; | 54 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() = 0; |
57 | 55 |
58 // Returns true if the surface is created on a UDL device. | 56 // Returns true if the surface is created on a UDL device. |
59 virtual bool IsUniversalDisplayLinkDevice(); | 57 virtual bool IsUniversalDisplayLinkDevice(); |
60 }; | 58 }; |
61 | 59 |
62 } // namespace ui | 60 } // namespace ui |
63 | 61 |
64 #endif // UI_OZONE_PUBLIC_SURFACE_OZONE_EGL_H_ | 62 #endif // UI_OZONE_PUBLIC_SURFACE_OZONE_EGL_H_ |
OLD | NEW |