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