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