| 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_GFX_CLIENT_NATIVE_PIXMAP_FACTORY_H_ | 5 #ifndef UI_GFX_CLIENT_NATIVE_PIXMAP_FACTORY_H_ |
| 6 #define UI_GFX_CLIENT_NATIVE_PIXMAP_FACTORY_H_ | 6 #define UI_GFX_CLIENT_NATIVE_PIXMAP_FACTORY_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/files/scoped_file.h" | 11 #include "base/files/scoped_file.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "ui/gfx/buffer_types.h" | 13 #include "ui/gfx/buffer_types.h" |
| 14 #include "ui/gfx/client_native_pixmap.h" | 14 #include "ui/gfx/client_native_pixmap.h" |
| 15 #include "ui/gfx/gfx_export.h" | 15 #include "ui/gfx/gfx_export.h" |
| 16 | 16 |
| 17 namespace gfx { | 17 namespace gfx { |
| 18 |
| 18 struct NativePixmapHandle; | 19 struct NativePixmapHandle; |
| 19 class Size; | 20 class Size; |
| 20 } | |
| 21 | |
| 22 namespace ui { | |
| 23 | 21 |
| 24 // The Ozone interface allows external implementations to hook into Chromium to | 22 // The Ozone interface allows external implementations to hook into Chromium to |
| 25 // provide a client pixmap for non-GPU processes. | 23 // provide a client pixmap for non-GPU processes. |
| 26 class GFX_EXPORT ClientNativePixmapFactory { | 24 class GFX_EXPORT ClientNativePixmapFactory { |
| 27 public: | 25 public: |
| 28 static ClientNativePixmapFactory* GetInstance(); | 26 static ClientNativePixmapFactory* GetInstance(); |
| 29 static void SetInstance(ClientNativePixmapFactory* instance); | 27 static void SetInstance(ClientNativePixmapFactory* instance); |
| 30 | 28 |
| 31 virtual ~ClientNativePixmapFactory(); | 29 virtual ~ClientNativePixmapFactory(); |
| 32 | 30 |
| 33 // Returns true if format/usage configuration is supported. | 31 // Returns true if format/usage configuration is supported. |
| 34 virtual bool IsConfigurationSupported(gfx::BufferFormat format, | 32 virtual bool IsConfigurationSupported(gfx::BufferFormat format, |
| 35 gfx::BufferUsage usage) const = 0; | 33 gfx::BufferUsage usage) const = 0; |
| 36 | 34 |
| 37 // TODO(dshwang): implement it. crbug.com/475633 | 35 // TODO(dshwang): implement it. crbug.com/475633 |
| 38 // Import the native pixmap from |handle| to be used in non-GPU processes. | 36 // Import the native pixmap from |handle| to be used in non-GPU processes. |
| 39 // This function takes ownership of any file descriptors in |handle|. | 37 // This function takes ownership of any file descriptors in |handle|. |
| 40 virtual std::unique_ptr<ClientNativePixmap> ImportFromHandle( | 38 virtual std::unique_ptr<ClientNativePixmap> ImportFromHandle( |
| 41 const gfx::NativePixmapHandle& handle, | 39 const gfx::NativePixmapHandle& handle, |
| 42 const gfx::Size& size, | 40 const gfx::Size& size, |
| 43 gfx::BufferUsage usage) = 0; | 41 gfx::BufferUsage usage) = 0; |
| 44 | 42 |
| 45 protected: | 43 protected: |
| 46 ClientNativePixmapFactory(); | 44 ClientNativePixmapFactory(); |
| 47 | 45 |
| 48 private: | 46 private: |
| 49 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactory); | 47 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactory); |
| 50 }; | 48 }; |
| 51 | 49 |
| 52 } // namespace ui | 50 } // namespace gfx |
| 53 | 51 |
| 54 #endif // UI_GFX_CLIENT_NATIVE_PIXMAP_FACTORY_H_ | 52 #endif // UI_GFX_CLIENT_NATIVE_PIXMAP_FACTORY_H_ |
| OLD | NEW |