OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_BASE_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ | 5 #ifndef UI_BASE_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ |
6 #define UI_BASE_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ | 6 #define UI_BASE_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ |
7 | 7 |
8 #include "ui/base/ui_export.h" | 8 #include "ui/base/ui_export.h" |
9 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
10 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
(...skipping 17 matching lines...) Expand all Loading... | |
28 // native surface. | 28 // native surface. |
29 virtual const char* DefaultDisplaySpec(); | 29 virtual const char* DefaultDisplaySpec(); |
30 | 30 |
31 // Sets the implementation delegate. Ownership is retained by the caller. | 31 // Sets the implementation delegate. Ownership is retained by the caller. |
32 static void SetInstance(SurfaceFactoryOzone* impl); | 32 static void SetInstance(SurfaceFactoryOzone* impl); |
33 | 33 |
34 // TODO(rjkroege): decide how to separate screen/display stuff from SFOz | 34 // TODO(rjkroege): decide how to separate screen/display stuff from SFOz |
35 // This method implements gfx::Screen, particularly useful in Desktop Aura. | 35 // This method implements gfx::Screen, particularly useful in Desktop Aura. |
36 virtual gfx::Screen* CreateDesktopScreen(); | 36 virtual gfx::Screen* CreateDesktopScreen(); |
37 | 37 |
38 // TODO(rjkroege): Add a status code if necessary. | |
39 // Configures the display hardware. Must be called from within the GPU | 38 // Configures the display hardware. Must be called from within the GPU |
40 // process before the sandbox has been activated. | 39 // process before the sandbox has been activated. |
41 virtual void InitializeHardware() = 0; | 40 virtual bool InitializeHardware() = 0; |
42 | 41 |
43 // Cleans up display hardware state. Call this from within the GPU process. | 42 // Cleans up display hardware state. Call this from within the GPU process. |
44 // This method must be safe to run inside of the sandbox. | 43 // This method must be safe to run inside of the sandbox. |
45 virtual void ShutdownHardware() = 0; | 44 virtual void ShutdownHardware() = 0; |
46 | 45 |
46 // Returns the native EGL display. This is generally needed in creating | |
47 // EGL windows. | |
48 virtual void* GetNativeDisplay(); | |
rjkroege
2013/08/27 16:03:42
It isn't safe to assume that a void* fits in an in
dnicoara
2013/08/28 14:58:03
Updated the definition to intptr_t.
| |
49 | |
47 // Obtains an AcceleratedWidget backed by a native Linux framebuffer. | 50 // Obtains an AcceleratedWidget backed by a native Linux framebuffer. |
48 // The returned AcceleratedWidget is an opaque token that must realized | 51 // The returned AcceleratedWidget is an opaque token that must realized |
49 // before it can be used to create a GL surface. | 52 // before it can be used to create a GL surface. |
50 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; | 53 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; |
51 | 54 |
52 // Realizes an AcceleratedWidget so that the returned AcceleratedWidget | 55 // Realizes an AcceleratedWidget so that the returned AcceleratedWidget |
53 // can be used to to create a GLSurface. This method may only be called in | 56 // can be used to to create a GLSurface. This method may only be called in |
54 // a process that has a valid GL context. | 57 // a process that has a valid GL context. |
55 virtual gfx::AcceleratedWidget RealizeAcceleratedWidget( | 58 virtual gfx::AcceleratedWidget RealizeAcceleratedWidget( |
56 gfx::AcceleratedWidget w) = 0; | 59 gfx::AcceleratedWidget w) = 0; |
57 | 60 |
58 // Sets up GL bindings for the native surface. | 61 // Sets up GL bindings for the native surface. |
59 virtual bool LoadEGLGLES2Bindings() = 0; | 62 virtual bool LoadEGLGLES2Bindings() = 0; |
60 | 63 |
61 // If possible attempts to resize the given AcceleratedWidget instance and if | 64 // If possible attempts to resize the given AcceleratedWidget instance and if |
62 // a resize action was performed returns true, otherwise false (native | 65 // a resize action was performed returns true, otherwise false (native |
63 // hardware may only support a single fixed size). | 66 // hardware may only support a single fixed size). |
64 virtual bool AttemptToResizeAcceleratedWidget( | 67 virtual bool AttemptToResizeAcceleratedWidget( |
65 gfx::AcceleratedWidget w, | 68 gfx::AcceleratedWidget w, |
66 const gfx::Rect& bounds) = 0; | 69 const gfx::Rect& bounds) = 0; |
67 | 70 |
71 // Called after the appropriate GL swap buffers command. Used if extra work | |
72 // is needed to perform the actual buffer swap. | |
73 virtual bool SwapBuffers(gfx::AcceleratedWidget w); | |
74 | |
68 // Returns a gfx::VsyncProvider for the provided AcceleratedWidget. Note | 75 // Returns a gfx::VsyncProvider for the provided AcceleratedWidget. Note |
69 // that this may be called after we have entered the sandbox so if there are | 76 // that this may be called after we have entered the sandbox so if there are |
70 // operations (e.g. opening a file descriptor providing vsync events) that | 77 // operations (e.g. opening a file descriptor providing vsync events) that |
71 // must be done outside of the sandbox, they must have been completed | 78 // must be done outside of the sandbox, they must have been completed |
72 // in InitializeHardware. Returns NULL on error. | 79 // in InitializeHardware. Returns NULL on error. |
73 virtual gfx::VSyncProvider* GetVSyncProvider(gfx::AcceleratedWidget w) = 0; | 80 virtual gfx::VSyncProvider* GetVSyncProvider(gfx::AcceleratedWidget w) = 0; |
74 | 81 |
75 // Create a default SufaceFactoryOzone implementation useful for tests. | 82 // Create a default SufaceFactoryOzone implementation useful for tests. |
76 static SurfaceFactoryOzone* CreateTestHelper(); | 83 static SurfaceFactoryOzone* CreateTestHelper(); |
77 | 84 |
78 private: | 85 private: |
79 static SurfaceFactoryOzone* impl_; // not owned | 86 static SurfaceFactoryOzone* impl_; // not owned |
80 }; | 87 }; |
81 | 88 |
82 } // namespace ui | 89 } // namespace ui |
83 | 90 |
84 | |
85 #endif // UI_BASE_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ | 91 #endif // UI_BASE_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ |
OLD | NEW |