OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_BASE_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ |
| 6 #define UI_BASE_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ |
| 7 |
| 8 #include "ui/gfx/native_widget_types.h" |
| 9 |
| 10 namespace gfx { |
| 11 class VSyncProvider; |
| 12 } // namespace gfx |
| 13 |
| 14 namespace ui { |
| 15 |
| 16 class SurfaceFactoryOzone { |
| 17 public: |
| 18 SurfaceFactoryOzone(); |
| 19 virtual ~SurfaceFactoryOzone(); |
| 20 |
| 21 // Returns the instance |
| 22 static SurfaceFactoryOzone* GetInstance(); |
| 23 |
| 24 // Returns a display spec as in |CreateDisplayFromSpec| for the default |
| 25 // native surface. |
| 26 virtual const char* DefaultDisplaySpec(); |
| 27 |
| 28 // Sets the implementation delegate. |
| 29 static void SetInstance(SurfaceFactoryOzone* impl); |
| 30 |
| 31 // TODO(rjkroege): Add a status code if necessary. |
| 32 // Configures the display hardware. Must be called from within the GPU |
| 33 // process before the sandbox has been activated. |
| 34 virtual void InitializeHardware() = 0; |
| 35 |
| 36 // Cleans up display hardware state. Call this from within the GPU process. |
| 37 // This method must be safe to run inside of the sandbox. |
| 38 virtual void ShutdownHardware() = 0; |
| 39 |
| 40 // Obtains an AcceleratedWidget backed by a native Linux framebuffer. |
| 41 // The returned AcceleratedWidget is an opaque token that must realized |
| 42 // before it can be used to create a GL surface. |
| 43 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; |
| 44 |
| 45 // Realizes an AcceleratedWidget so that the returned AcceleratedWidget |
| 46 // can be used to to create a GLSurface. This method may only be called in |
| 47 // a process that has a valid GL context. |
| 48 virtual gfx::AcceleratedWidget RealizeAcceleratedWidget( |
| 49 gfx::AcceleratedWidget w) = 0; |
| 50 |
| 51 // Sets up GL bindings for the native surface. |
| 52 virtual bool LoadEGLGLES2Bindings() = 0; |
| 53 |
| 54 // Tests if the given AcceleratedWidget instance can be resized. (Native |
| 55 // hardware may only support a single fixed size.) |
| 56 // Perhaps, this should be "attempt to resize the accelerated widget"? |
| 57 virtual bool AcceleratedWidgetCanBeResized(gfx::AcceleratedWidget w) = 0; |
| 58 |
| 59 // Returns a gfx::VsyncProvider for the provided AcceleratedWidget. Note |
| 60 // that this may be called after we have entered the sandbox so if there are |
| 61 // operations (e.g. opening a file descriptor providing vsync events) that |
| 62 // must be done outside of the sandbox, they must have been completed |
| 63 // in InitializeHardware. Returns NULL on error. |
| 64 virtual gfx::VSyncProvider* GetVSyncProvider(gfx::AcceleratedWidget w) = 0; |
| 65 }; |
| 66 |
| 67 } // namespace ui |
| 68 |
| 69 |
| 70 #endif // UI_BASE_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ |
OLD | NEW |