| 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_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ | 5 #ifndef UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ |
| 6 #define UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ | 6 #define UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/native_library.h" | 10 #include "base/native_library.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // The following function is specific to the software path: | 51 // The following function is specific to the software path: |
| 52 // - CreateCanvasForWidget | 52 // - CreateCanvasForWidget |
| 53 // | 53 // |
| 54 // The accelerated path can optionally provide support for the software drawing | 54 // The accelerated path can optionally provide support for the software drawing |
| 55 // path. | 55 // path. |
| 56 // | 56 // |
| 57 // The remaining functions are not covered since they are needed in both drawing | 57 // The remaining functions are not covered since they are needed in both drawing |
| 58 // modes (See comments bellow for descriptions). | 58 // modes (See comments bellow for descriptions). |
| 59 class OZONE_BASE_EXPORT SurfaceFactoryOzone { | 59 class OZONE_BASE_EXPORT SurfaceFactoryOzone { |
| 60 public: | 60 public: |
| 61 // Describes the state of the hardware after initialization. | |
| 62 enum HardwareState { | |
| 63 UNINITIALIZED, | |
| 64 INITIALIZED, | |
| 65 FAILED, | |
| 66 }; | |
| 67 | |
| 68 // Describes overlay buffer format. | 61 // Describes overlay buffer format. |
| 69 // TODO: this is a placeholder for now and will be populated with more | 62 // TODO: this is a placeholder for now and will be populated with more |
| 70 // formats once we know what sorts of content, video, etc. we can support. | 63 // formats once we know what sorts of content, video, etc. we can support. |
| 71 enum BufferFormat { | 64 enum BufferFormat { |
| 72 UNKNOWN, | 65 UNKNOWN, |
| 73 RGBA_8888, | 66 RGBA_8888, |
| 74 RGB_888, | 67 RGB_888, |
| 75 }; | 68 }; |
| 76 | 69 |
| 77 typedef void* (*GLGetProcAddressProc)(const char* name); | 70 typedef void* (*GLGetProcAddressProc)(const char* name); |
| 78 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback; | 71 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback; |
| 79 typedef base::Callback<void(GLGetProcAddressProc)> | 72 typedef base::Callback<void(GLGetProcAddressProc)> |
| 80 SetGLGetProcAddressProcCallback; | 73 SetGLGetProcAddressProcCallback; |
| 81 | 74 |
| 82 SurfaceFactoryOzone(); | 75 SurfaceFactoryOzone(); |
| 83 virtual ~SurfaceFactoryOzone(); | 76 virtual ~SurfaceFactoryOzone(); |
| 84 | 77 |
| 85 // Returns the singleton instance. | 78 // Returns the singleton instance. |
| 86 static SurfaceFactoryOzone* GetInstance(); | 79 static SurfaceFactoryOzone* GetInstance(); |
| 87 | 80 |
| 88 // Configures the display hardware. Must be called from within the GPU | |
| 89 // process before the sandbox has been activated. | |
| 90 virtual HardwareState InitializeHardware() = 0; | |
| 91 | |
| 92 // Cleans up display hardware state. Call this from within the GPU process. | |
| 93 // This method must be safe to run inside of the sandbox. | |
| 94 virtual void ShutdownHardware() = 0; | |
| 95 | |
| 96 // Returns native platform display handle. This is used to obtain the EGL | 81 // Returns native platform display handle. This is used to obtain the EGL |
| 97 // display connection for the native display. | 82 // display connection for the native display. |
| 98 virtual intptr_t GetNativeDisplay(); | 83 virtual intptr_t GetNativeDisplay(); |
| 99 | 84 |
| 100 // Create SurfaceOzoneEGL for the specified gfx::AcceleratedWidget. | 85 // Create SurfaceOzoneEGL for the specified gfx::AcceleratedWidget. |
| 101 // | 86 // |
| 102 // Note: When used from content, this is called in the GPU process. The | 87 // Note: When used from content, this is called in the GPU process. The |
| 103 // platform must support creation of SurfaceOzoneEGL from the GPU process | 88 // platform must support creation of SurfaceOzoneEGL from the GPU process |
| 104 // using only the handle contained in gfx::AcceleratedWidget. | 89 // using only the handle contained in gfx::AcceleratedWidget. |
| 105 virtual scoped_ptr<SurfaceOzoneEGL> CreateEGLSurfaceForWidget( | 90 virtual scoped_ptr<SurfaceOzoneEGL> CreateEGLSurfaceForWidget( |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // overlay-only mode. | 124 // overlay-only mode. |
| 140 virtual bool CanShowPrimaryPlaneAsOverlay(); | 125 virtual bool CanShowPrimaryPlaneAsOverlay(); |
| 141 | 126 |
| 142 private: | 127 private: |
| 143 static SurfaceFactoryOzone* impl_; // not owned | 128 static SurfaceFactoryOzone* impl_; // not owned |
| 144 }; | 129 }; |
| 145 | 130 |
| 146 } // namespace ui | 131 } // namespace ui |
| 147 | 132 |
| 148 #endif // UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ | 133 #endif // UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ |
| OLD | NEW |