| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_GPU_GPU_MEMORY_BUFFER_FACTORY_OZONE_NATIVE_BUFFER_H_ | 5 #ifndef UI_OZONE_GPU_GPU_MEMORY_BUFFER_FACTORY_OZONE_NATIVE_BUFFER_H_ |
| 6 #define UI_OZONE_GPU_GPU_MEMORY_BUFFER_FACTORY_OZONE_NATIVE_BUFFER_H_ | 6 #define UI_OZONE_GPU_GPU_MEMORY_BUFFER_FACTORY_OZONE_NATIVE_BUFFER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 class OZONE_GPU_EXPORT GpuMemoryBufferFactoryOzoneNativeBuffer { | 25 class OZONE_GPU_EXPORT GpuMemoryBufferFactoryOzoneNativeBuffer { |
| 26 typedef std::map<std::pair<uint32_t, uint32_t>, scoped_refptr<NativePixmap> > | 26 typedef std::map<std::pair<uint32_t, uint32_t>, scoped_refptr<NativePixmap> > |
| 27 BufferToPixmapMap; | 27 BufferToPixmapMap; |
| 28 | 28 |
| 29 public: | 29 public: |
| 30 GpuMemoryBufferFactoryOzoneNativeBuffer(); | 30 GpuMemoryBufferFactoryOzoneNativeBuffer(); |
| 31 virtual ~GpuMemoryBufferFactoryOzoneNativeBuffer(); | 31 virtual ~GpuMemoryBufferFactoryOzoneNativeBuffer(); |
| 32 | 32 |
| 33 // Creates a GPU memory buffer identified by |id|. | 33 // Creates a GPU memory buffer identified by |id|. |
| 34 // It can be called on any thread. | 34 // It can be called on any thread. |
| 35 bool CreateGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 35 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( |
| 36 const gfx::Size& size, | 36 gfx::GpuMemoryBufferId id, |
| 37 gfx::GpuMemoryBuffer::Format format, | 37 const gfx::Size& size, |
| 38 gfx::GpuMemoryBuffer::Usage usage, | 38 gfx::GpuMemoryBuffer::Format format, |
| 39 int client_id, | 39 gfx::GpuMemoryBuffer::Usage usage, |
| 40 gfx::PluginWindowHandle surface_handle); | 40 int client_id, |
| 41 gfx::PluginWindowHandle surface_handle); |
| 41 | 42 |
| 42 // Destroys GPU memory buffer identified by |id|. | 43 // Destroys GPU memory buffer identified by |id|. |
| 43 // It can be called on any thread. | 44 // It can be called on any thread. |
| 44 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, int client_id); | 45 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, int client_id); |
| 45 | 46 |
| 46 // Creates a GLImage instance for GPU memory buffer identified by |id|. | 47 // Creates a GLImage instance for GPU memory buffer identified by |id|. |
| 47 scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( | 48 scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( |
| 48 gfx::GpuMemoryBufferId id, | 49 gfx::GpuMemoryBufferId id, |
| 49 const gfx::Size& size, | 50 const gfx::Size& size, |
| 50 gfx::GpuMemoryBuffer::Format format, | 51 gfx::GpuMemoryBuffer::Format format, |
| 51 unsigned internalformat, | 52 unsigned internalformat, |
| 52 int client_id); | 53 int client_id); |
| 53 | 54 |
| 54 static scoped_refptr<gfx::GLImage> CreateImageForPixmap( | 55 static scoped_refptr<gfx::GLImage> CreateImageForPixmap( |
| 55 scoped_refptr<NativePixmap> pixmap, | 56 scoped_refptr<NativePixmap> pixmap, |
| 56 const gfx::Size& size, | 57 const gfx::Size& size, |
| 57 gfx::GpuMemoryBuffer::Format format, | 58 gfx::GpuMemoryBuffer::Format format, |
| 58 unsigned internalformat); | 59 unsigned internalformat); |
| 59 | 60 |
| 60 private: | 61 private: |
| 61 BufferToPixmapMap native_pixmap_map_; | 62 BufferToPixmapMap native_pixmap_map_; |
| 62 base::Lock native_pixmap_map_lock_; | 63 base::Lock native_pixmap_map_lock_; |
| 63 }; | 64 }; |
| 64 | 65 |
| 65 } // namespace ui | 66 } // namespace ui |
| 66 | 67 |
| 67 #endif // UI_OZONE_GPU_GPU_MEMORY_BUFFER_FACTORY_OZONE_NATIVE_BUFFER_H_ | 68 #endif // UI_OZONE_GPU_GPU_MEMORY_BUFFER_FACTORY_OZONE_NATIVE_BUFFER_H_ |
| OLD | NEW |