Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: gpu/ipc/service/gpu_memory_buffer_factory_io_surface.h

Issue 1845563005: Refactor content/common/gpu into gpu/ipc/service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Drop ref to deleted content_tests_gypi_values.content_unittests_ozone_sources Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ 5 #ifndef GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_
6 #define CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ 6 #define GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_
7 7
8 #include <utility> 8 #include <utility>
9 9
10 #include <IOSurface/IOSurface.h> 10 #include <IOSurface/IOSurface.h>
11 11
12 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
13 #include "base/mac/scoped_cftyperef.h" 13 #include "base/mac/scoped_cftyperef.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/synchronization/lock.h" 16 #include "base/synchronization/lock.h"
17 #include "content/common/content_export.h"
18 #include "content/common/gpu/gpu_memory_buffer_factory.h"
19 #include "gpu/command_buffer/service/image_factory.h" 17 #include "gpu/command_buffer/service/image_factory.h"
18 #include "gpu/gpu_export.h"
19 #include "gpu/ipc/service/gpu_memory_buffer_factory.h"
20 #include "ui/gfx/geometry/size.h" 20 #include "ui/gfx/geometry/size.h"
21 #include "ui/gfx/gpu_memory_buffer.h" 21 #include "ui/gfx/gpu_memory_buffer.h"
22 #include "ui/gfx/mac/io_surface.h" 22 #include "ui/gfx/mac/io_surface.h"
23 23
24 namespace gl { 24 namespace gl {
25 class GLImage; 25 class GLImage;
26 } 26 }
27 27
28 namespace content { 28 namespace gpu {
29 29
30 class CONTENT_EXPORT GpuMemoryBufferFactoryIOSurface 30 class GPU_EXPORT GpuMemoryBufferFactoryIOSurface
31 : public GpuMemoryBufferFactory, 31 : public GpuMemoryBufferFactory,
32 public gpu::ImageFactory { 32 public ImageFactory {
33 public: 33 public:
34 GpuMemoryBufferFactoryIOSurface(); 34 GpuMemoryBufferFactoryIOSurface();
35 ~GpuMemoryBufferFactoryIOSurface() override; 35 ~GpuMemoryBufferFactoryIOSurface() override;
36 36
37 // Overridden from GpuMemoryBufferFactory: 37 // Overridden from GpuMemoryBufferFactory:
38 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( 38 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer(
39 gfx::GpuMemoryBufferId id, 39 gfx::GpuMemoryBufferId id,
40 const gfx::Size& size, 40 const gfx::Size& size,
41 gfx::BufferFormat format, 41 gfx::BufferFormat format,
42 gfx::BufferUsage usage, 42 gfx::BufferUsage usage,
43 int client_id, 43 int client_id,
44 gpu::SurfaceHandle surface_handle) override; 44 SurfaceHandle surface_handle) override;
45 gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromHandle( 45 gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromHandle(
46 const gfx::GpuMemoryBufferHandle& handle, 46 const gfx::GpuMemoryBufferHandle& handle,
47 gfx::GpuMemoryBufferId id, 47 gfx::GpuMemoryBufferId id,
48 const gfx::Size& size, 48 const gfx::Size& size,
49 gfx::BufferFormat format, 49 gfx::BufferFormat format,
50 int client_id) override; 50 int client_id) override;
51 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, 51 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
52 int client_id) override; 52 int client_id) override;
53 gpu::ImageFactory* AsImageFactory() override; 53 ImageFactory* AsImageFactory() override;
54 54
55 // Overridden from gpu::ImageFactory: 55 // Overridden from ImageFactory:
56 scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer( 56 scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer(
57 const gfx::GpuMemoryBufferHandle& handle, 57 const gfx::GpuMemoryBufferHandle& handle,
58 const gfx::Size& size, 58 const gfx::Size& size,
59 gfx::BufferFormat format, 59 gfx::BufferFormat format,
60 unsigned internalformat, 60 unsigned internalformat,
61 int client_id) override; 61 int client_id) override;
62 62
63 private: 63 private:
64 typedef std::pair<gfx::IOSurfaceId, int> IOSurfaceMapKey; 64 typedef std::pair<gfx::IOSurfaceId, int> IOSurfaceMapKey;
65 typedef base::hash_map<IOSurfaceMapKey, base::ScopedCFTypeRef<IOSurfaceRef>> 65 typedef base::hash_map<IOSurfaceMapKey, base::ScopedCFTypeRef<IOSurfaceRef>>
66 IOSurfaceMap; 66 IOSurfaceMap;
67 // TOOD(reveman): Remove |io_surfaces_| and allow IOSurface backed GMBs to be 67 // TOOD(reveman): Remove |io_surfaces_| and allow IOSurface backed GMBs to be
68 // used with any GPU process by passing a mach_port to CreateImageCHROMIUM. 68 // used with any GPU process by passing a mach_port to CreateImageCHROMIUM.
69 IOSurfaceMap io_surfaces_; 69 IOSurfaceMap io_surfaces_;
70 base::Lock io_surfaces_lock_; 70 base::Lock io_surfaces_lock_;
71 71
72 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryIOSurface); 72 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryIOSurface);
73 }; 73 };
74 74
75 } // namespace content 75 } // namespace gpu
76 76
77 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ 77 #endif // GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_
OLDNEW
« no previous file with comments | « gpu/ipc/service/gpu_memory_buffer_factory.cc ('k') | gpu/ipc/service/gpu_memory_buffer_factory_io_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698