Chromium Code Reviews| Index: ui/base/ozone/surface_factory_ozone.h |
| diff --git a/ui/base/ozone/surface_factory_ozone.h b/ui/base/ozone/surface_factory_ozone.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c31f829adaffe5987d671d0363a4a2849577be9c |
| --- /dev/null |
| +++ b/ui/base/ozone/surface_factory_ozone.h |
| @@ -0,0 +1,74 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef UI_BASE_LINUX_NATIVE_SURFACE_LNUX_FACTORY_ |
| +#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.
|
| + |
| +#include "base/memory/scoped_ptr.h" |
| +#include "ui/gfx/native_widget_types.h" |
| + |
| +namespace gfx { |
| +class VSyncProvider; |
| +} // namespace gfx |
| + |
| +namespace ui { |
| + |
| +class SurfaceFactoryDelegate; |
| + |
| +template <typename T> struct DefaultSingletonTraits; |
| +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.
|
| + public: |
| + SurfaceFactory(); |
| + ~SurfaceFactory(); |
| + |
| + static SurfaceFactory* GetInstance(); |
| + |
| + // Returns a display spec as in |CreateDisplayFromSpec| for the default |
| + // native surface. |
| + const char* DefaultDisplaySpec(); |
| + |
| + // Set an optional delegate. |
| + void SetDelegate(SurfaceFactoryDelegate* delegate); |
| + |
| + // TODO(rjkroege): Add a status code if necessary. |
| + // Configure display hardware. Must be called from within the GPU process |
| + // before the sandbox has been activated. |
| + void InitializeHardware(); |
| + |
| + // Clean up display hardware state. Call this from within the GPU process. |
| + // This method must be safe to run inside of the sandbox. |
| + void ShutdownHardware(); |
| + |
| + // Obtain an AcceleratedWidget backed by a native Linux framebuffer. |
| + // The AcceleratedWidget is valid only in the GPU process. |
| + gfx::AcceleratedWidget GetAcceleratedWidget( |
| + const gfx::GLSurfaceHandle& handle); |
| + |
| + // Sets up GL bindings for the native surface. |
| + bool LoadEGLGLES2Bindings(); |
| + |
| + // TODO(rjkroege): do I still need this? |
| + // Test if the given AcceleratedWidget instance can be resized. (Native |
| + // hardware may only support a single fixed size.) |
| + // Perhaps, this should be "attempt to resize the accelerated widget"? |
| + bool AcceleratedWidgetCanBeResized(gfx::AcceleratedWidget w); |
| + |
| + // Returns a gfx::VsyncProvider for the provided AcceleratedWidget. Note |
| + // that this may be called after we have entered the sandbox so if there are |
| + // operations (e.g. opening a file descriptor providing vsync events) that |
| + // must be done outside of the sandbox, they must have been completed |
| + // in InitializeHardware. Returns NULL on error. |
| + gfx::VSyncProvider* GetVSyncProvider(gfx::AcceleratedWidget w); |
| + |
| + private: |
| + friend struct DefaultSingletonTraits<SurfaceFactory>; |
| + scoped_ptr<SurfaceFactoryDelegate> delegate_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SurfaceFactory); |
| +}; |
| + |
| +} // namespace ui |
| + |
| + |
| +#endif // UI_BASE_LINUX_NATIVE_SURFACE_LNUX_FACTORY_ |