Chromium Code Reviews| 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_LINUX_NATIVE_SURFACE_LNUX_FACTORY_ | |
| 6 #define UI_BASE_LINUX_NATIVE_SURFACE_LNUX_FACTORY_ | |
|
piman
2013/05/18 01:47:19
nit: guard is wrong
rjkroege
2013/05/21 17:36:28
Done.
| |
| 7 | |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "ui/gfx/native_widget_types.h" | |
| 10 | |
| 11 namespace gfx { | |
| 12 class VSyncProvider; | |
| 13 } // namespace gfx | |
| 14 | |
| 15 namespace ui { | |
| 16 | |
| 17 class SurfaceFactoryDelegate; | |
| 18 | |
| 19 template <typename T> struct DefaultSingletonTraits; | |
| 20 class SurfaceFactory { | |
|
piman
2013/05/18 01:47:19
TBH I'm not sure why we have a separate SurfaceFac
rjkroege
2013/05/21 17:36:28
OK. Done.
| |
| 21 public: | |
| 22 SurfaceFactory(); | |
| 23 ~SurfaceFactory(); | |
| 24 | |
| 25 static SurfaceFactory* GetInstance(); | |
| 26 | |
| 27 // Returns a display spec as in |CreateDisplayFromSpec| for the default | |
| 28 // native surface. | |
| 29 const char* DefaultDisplaySpec(); | |
| 30 | |
| 31 // Set an optional delegate. | |
| 32 void SetDelegate(SurfaceFactoryDelegate* delegate); | |
| 33 | |
| 34 // TODO(rjkroege): Add a status code if necessary. | |
| 35 // Configure display hardware. Must be called from within the GPU process | |
| 36 // before the sandbox has been activated. | |
| 37 void InitializeHardware(); | |
| 38 | |
| 39 // Clean up display hardware state. Call this from within the GPU process. | |
| 40 // This method must be safe to run inside of the sandbox. | |
| 41 void ShutdownHardware(); | |
| 42 | |
| 43 // Obtain an AcceleratedWidget backed by a native Linux framebuffer. | |
| 44 // The AcceleratedWidget is valid only in the GPU process. | |
| 45 gfx::AcceleratedWidget GetAcceleratedWidget( | |
| 46 const gfx::GLSurfaceHandle& handle); | |
| 47 | |
| 48 // Sets up GL bindings for the native surface. | |
| 49 bool LoadEGLGLES2Bindings(); | |
| 50 | |
| 51 // TODO(rjkroege): do I still need this? | |
| 52 // Test if the given AcceleratedWidget instance can be resized. (Native | |
| 53 // hardware may only support a single fixed size.) | |
| 54 // Perhaps, this should be "attempt to resize the accelerated widget"? | |
| 55 bool AcceleratedWidgetCanBeResized(gfx::AcceleratedWidget w); | |
| 56 | |
| 57 // Returns a gfx::VsyncProvider for the provided AcceleratedWidget. Note | |
| 58 // that this may be called after we have entered the sandbox so if there are | |
| 59 // operations (e.g. opening a file descriptor providing vsync events) that | |
| 60 // must be done outside of the sandbox, they must have been completed | |
| 61 // in InitializeHardware. Returns NULL on error. | |
| 62 gfx::VSyncProvider* GetVSyncProvider(gfx::AcceleratedWidget w); | |
| 63 | |
| 64 private: | |
| 65 friend struct DefaultSingletonTraits<SurfaceFactory>; | |
| 66 scoped_ptr<SurfaceFactoryDelegate> delegate_; | |
| 67 | |
| 68 DISALLOW_COPY_AND_ASSIGN(SurfaceFactory); | |
| 69 }; | |
| 70 | |
| 71 } // namespace ui | |
| 72 | |
| 73 | |
| 74 #endif // UI_BASE_LINUX_NATIVE_SURFACE_LNUX_FACTORY_ | |
| OLD | NEW |