| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_NATIVE_PIXMAP_MANAGER_H_ | 5 #ifndef UI_OZONE_PUBLIC_NATIVE_PIXMAP_MANAGER_H_ |
| 6 #define UI_OZONE_PUBLIC_NATIVE_PIXMAP_MANAGER_H_ | 6 #define UI_OZONE_PUBLIC_NATIVE_PIXMAP_MANAGER_H_ |
| 7 | 7 |
| 8 #include "ui/ozone/ozone_export.h" | 8 #include "ui/ozone/ozone_export.h" |
| 9 #include "ui/ozone/public/native_pixmap.h" |
| 9 #include "ui/ozone/public/surface_factory_ozone.h" | 10 #include "ui/ozone/public/surface_factory_ozone.h" |
| 10 | 11 |
| 11 namespace base { | 12 namespace base { |
| 12 | 13 |
| 13 struct FileDescriptor; | 14 struct FileDescriptor; |
| 14 | 15 |
| 15 } // namespace base | 16 } // namespace base |
| 16 | 17 |
| 17 namespace ui { | 18 namespace ui { |
| 18 | 19 |
| 19 // The Ozone interface allows external implementations to hook into Chromium to | 20 // The Ozone interface allows external implementations to hook into Chromium to |
| 20 // provide the handle of a system specific surface implementation for Browser | 21 // provide the handle of a system specific surface implementation for Browser |
| 21 // and Render process. | 22 // and Render process. |
| 22 class OZONE_EXPORT NativePixmapManager { | 23 class OZONE_EXPORT NativePixmapManager { |
| 23 public: | 24 public: |
| 24 static scoped_ptr<NativePixmapManager> Create( | 25 static scoped_ptr<NativePixmapManager> Create( |
| 25 const base::FileDescriptor& device_fd); | 26 const base::FileDescriptor& device_fd); |
| 26 | 27 |
| 27 virtual ~NativePixmapManager(); | 28 virtual ~NativePixmapManager(); |
| 28 | 29 |
| 29 struct Configuration { | 30 struct Configuration { |
| 30 SurfaceFactoryOzone::BufferFormat format; | 31 SurfaceFactoryOzone::BufferFormat format; |
| 31 SurfaceFactoryOzone::BufferUsage usage; | 32 SurfaceFactoryOzone::BufferUsage usage; |
| 32 }; | 33 }; |
| 33 | 34 |
| 34 // Gets supported format/usage configurations. | 35 // Gets supported format/usage configurations. |
| 35 virtual std::vector<Configuration> GetSupportedNativePixmapConfigurations() | 36 virtual std::vector<Configuration> GetSupportedNativePixmapConfigurations() |
| 36 const = 0; | 37 const = 0; |
| 37 | 38 |
| 39 // Create a single native buffer from |handle| to be used for zero copy in |
| 40 // Browser or Render process. |
| 41 virtual scoped_refptr<NativePixmap> CreateFromFileDescriptor( |
| 42 base::FileDescriptor handle, |
| 43 gfx::Size size, |
| 44 SurfaceFactoryOzone::BufferFormat format, |
| 45 SurfaceFactoryOzone::BufferUsage usage) = 0; |
| 46 |
| 38 protected: | 47 protected: |
| 39 NativePixmapManager(); | 48 NativePixmapManager(); |
| 40 | 49 |
| 41 virtual void Initialize(const base::FileDescriptor& device_fd) = 0; | 50 virtual void Initialize(const base::FileDescriptor& device_fd) = 0; |
| 42 | 51 |
| 43 private: | 52 private: |
| 44 DISALLOW_COPY_AND_ASSIGN(NativePixmapManager); | 53 DISALLOW_COPY_AND_ASSIGN(NativePixmapManager); |
| 45 }; | 54 }; |
| 46 | 55 |
| 47 // Platforms which don't need to share native pixmap use this. | 56 // Platforms which don't need to share native pixmap use this. |
| 48 NativePixmapManager* CreateStubNativePixmapManager(); | 57 NativePixmapManager* CreateStubNativePixmapManager(); |
| 49 | 58 |
| 50 } // namespace ui | 59 } // namespace ui |
| 51 | 60 |
| 52 #endif // UI_OZONE_PUBLIC_NATIVE_PIXMAP_MANAGER_H_ | 61 #endif // UI_OZONE_PUBLIC_NATIVE_PIXMAP_MANAGER_H_ |
| OLD | NEW |