| 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_CLIENT_NATIVE_PIXMAP_FACTORY_H_ | 5 #ifndef UI_OZONE_PUBLIC_CLIENT_NATIVE_PIXMAP_FACTORY_H_ |
| 6 #define UI_OZONE_PUBLIC_CLIENT_NATIVE_PIXMAP_FACTORY_H_ | 6 #define UI_OZONE_PUBLIC_CLIENT_NATIVE_PIXMAP_FACTORY_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/files/scoped_file.h" |
| 10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 11 #include "ui/gfx/buffer_types.h" | 12 #include "ui/gfx/buffer_types.h" |
| 12 #include "ui/ozone/ozone_export.h" | 13 #include "ui/ozone/ozone_export.h" |
| 13 #include "ui/ozone/public/client_native_pixmap.h" | 14 #include "ui/ozone/public/client_native_pixmap.h" |
| 14 | 15 |
| 15 namespace gfx { | 16 namespace gfx { |
| 16 struct NativePixmapHandle; | 17 struct NativePixmapHandle; |
| 17 class Size; | 18 class Size; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace base { | |
| 21 | |
| 22 struct FileDescriptor; | |
| 23 | |
| 24 } // namespace base | |
| 25 | |
| 26 namespace ui { | 21 namespace ui { |
| 27 | 22 |
| 28 // The Ozone interface allows external implementations to hook into Chromium to | 23 // The Ozone interface allows external implementations to hook into Chromium to |
| 29 // provide a client pixmap for non-GPU processes. | 24 // provide a client pixmap for non-GPU processes. |
| 30 class OZONE_EXPORT ClientNativePixmapFactory { | 25 class OZONE_EXPORT ClientNativePixmapFactory { |
| 31 public: | 26 public: |
| 32 static ClientNativePixmapFactory* GetInstance(); | 27 static ClientNativePixmapFactory* GetInstance(); |
| 33 static void SetInstance(ClientNativePixmapFactory* instance); | 28 static void SetInstance(ClientNativePixmapFactory* instance); |
| 34 | 29 |
| 35 static scoped_ptr<ClientNativePixmapFactory> Create(); | 30 static scoped_ptr<ClientNativePixmapFactory> Create(); |
| 36 | 31 |
| 37 virtual ~ClientNativePixmapFactory(); | 32 virtual ~ClientNativePixmapFactory(); |
| 38 | 33 |
| 34 // Initialize with the given client native pixmap |device_fd|. |
| 35 virtual void Initialize(base::ScopedFD device_fd) = 0; |
| 36 |
| 39 struct Configuration { | 37 struct Configuration { |
| 40 gfx::BufferFormat format; | 38 gfx::BufferFormat format; |
| 41 gfx::BufferUsage usage; | 39 gfx::BufferUsage usage; |
| 42 }; | 40 }; |
| 43 | 41 |
| 44 // Gets supported format/usage configurations. | 42 // Gets supported format/usage configurations. |
| 45 virtual std::vector<Configuration> GetSupportedConfigurations() const = 0; | 43 virtual std::vector<Configuration> GetSupportedConfigurations() const = 0; |
| 46 | 44 |
| 47 // TODO(dshwang): implement it. crbug.com/475633 | 45 // TODO(dshwang): implement it. crbug.com/475633 |
| 48 // Import the native pixmap from |handle| to be used in non-GPU processes. | 46 // Import the native pixmap from |handle| to be used in non-GPU processes. |
| 49 // This function takes ownership of any file descriptors in |handle|. | 47 // This function takes ownership of any file descriptors in |handle|. |
| 50 virtual scoped_ptr<ClientNativePixmap> ImportFromHandle( | 48 virtual scoped_ptr<ClientNativePixmap> ImportFromHandle( |
| 51 const gfx::NativePixmapHandle& handle, | 49 const gfx::NativePixmapHandle& handle, |
| 52 const gfx::Size& size, | 50 const gfx::Size& size, |
| 53 gfx::BufferUsage usage) = 0; | 51 gfx::BufferUsage usage) = 0; |
| 54 | 52 |
| 55 protected: | 53 protected: |
| 56 ClientNativePixmapFactory(); | 54 ClientNativePixmapFactory(); |
| 57 | 55 |
| 58 private: | 56 private: |
| 59 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactory); | 57 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactory); |
| 60 }; | 58 }; |
| 61 | 59 |
| 62 } // namespace ui | 60 } // namespace ui |
| 63 | 61 |
| 64 #endif // UI_OZONE_PUBLIC_CLIENT_NATIVE_PIXMAP_FACTORY_H_ | 62 #endif // UI_OZONE_PUBLIC_CLIENT_NATIVE_PIXMAP_FACTORY_H_ |
| OLD | NEW |