Chromium Code Reviews| 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/file_descriptor_posix.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 // Open VGEM device file. A caller takes ownership of the file descriptor. | |
| 35 virtual int OpenVgemFD() const = 0; | |
|
reveman
2015/08/14 13:19:13
could this return a ScopedFD to make the ownership
dshwang
2015/08/14 16:20:27
Done.
| |
| 36 | |
| 37 // Set VGEM device file. This takes ownership of the file descriptor. | |
| 38 virtual void SetVgemFD(const base::FileDescriptor& vgem_fd) = 0; | |
|
reveman
2015/08/14 13:19:13
Can we pass a ScopedFD to this function instead?
dshwang
2015/08/14 16:20:27
Done.
| |
| 39 | |
| 39 struct Configuration { | 40 struct Configuration { |
| 40 gfx::BufferFormat format; | 41 gfx::BufferFormat format; |
| 41 gfx::BufferUsage usage; | 42 gfx::BufferUsage usage; |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 // Gets supported format/usage configurations. | 45 // Gets supported format/usage configurations. |
| 45 virtual std::vector<Configuration> GetSupportedConfigurations() const = 0; | 46 virtual std::vector<Configuration> GetSupportedConfigurations() const = 0; |
| 46 | 47 |
| 47 // TODO(dshwang): implement it. crbug.com/475633 | 48 // TODO(dshwang): implement it. crbug.com/475633 |
| 48 // Import the native pixmap from |handle| to be used in non-GPU processes. | 49 // Import the native pixmap from |handle| to be used in non-GPU processes. |
| 49 // This function takes ownership of any file descriptors in |handle|. | 50 // This function takes ownership of any file descriptors in |handle|. |
| 50 virtual scoped_ptr<ClientNativePixmap> ImportFromHandle( | 51 virtual scoped_ptr<ClientNativePixmap> ImportFromHandle( |
| 51 const gfx::NativePixmapHandle& handle, | 52 const gfx::NativePixmapHandle& handle, |
| 52 const gfx::Size& size, | 53 const gfx::Size& size, |
| 53 gfx::BufferUsage usage) = 0; | 54 gfx::BufferUsage usage) = 0; |
| 54 | 55 |
| 55 protected: | 56 protected: |
| 56 ClientNativePixmapFactory(); | 57 ClientNativePixmapFactory(); |
| 57 | 58 |
| 58 private: | 59 private: |
| 59 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactory); | 60 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactory); |
| 60 }; | 61 }; |
| 61 | 62 |
| 62 } // namespace ui | 63 } // namespace ui |
| 63 | 64 |
| 64 #endif // UI_OZONE_PUBLIC_CLIENT_NATIVE_PIXMAP_FACTORY_H_ | 65 #endif // UI_OZONE_PUBLIC_CLIENT_NATIVE_PIXMAP_FACTORY_H_ |
| OLD | NEW |