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

Side by Side Diff: content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h

Issue 634083002: gpu: Compositor management of GpuMemoryBuffer instances. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cc-pre-chromium-image-refactor
Patch Set: rebase Created 6 years, 2 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_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_
7 7
8 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" 8 #include "content/common/gpu/client/gpu_memory_buffer_impl.h"
9 9
10 struct ANativeWindow; 10 struct ANativeWindow;
11 11
12 namespace content { 12 namespace content {
13 13
14 // Implementation of GPU memory buffer based on SurfaceTextures. 14 // Implementation of GPU memory buffer based on SurfaceTextures.
15 class GpuMemoryBufferImplSurfaceTexture : public GpuMemoryBufferImpl { 15 class GpuMemoryBufferImplSurfaceTexture : public GpuMemoryBufferImpl {
16 public: 16 public:
17 static void Create(const gfx::Size& size, 17 static void Create(const gfx::Size& size,
18 unsigned internalformat, 18 Format format,
19 unsigned usage,
20 int client_id, 19 int client_id,
21 const CreationCallback& callback); 20 const CreationCallback& callback);
22 21
23 static void AllocateForChildProcess(const gfx::Size& size, 22 static void AllocateForChildProcess(const gfx::Size& size,
24 unsigned internalformat, 23 Format format,
25 unsigned usage,
26 int child_client_id, 24 int child_client_id,
27 const AllocationCallback& callback); 25 const AllocationCallback& callback);
28 26
29 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( 27 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle(
30 const gfx::GpuMemoryBufferHandle& handle, 28 const gfx::GpuMemoryBufferHandle& handle,
31 const gfx::Size& size, 29 const gfx::Size& size,
32 unsigned internalformat, 30 Format format,
33 const DestructionCallback& callback); 31 const DestructionCallback& callback);
34 32
35 static bool IsFormatSupported(unsigned internalformat); 33 static bool IsFormatSupported(Format format);
36 static bool IsUsageSupported(unsigned usage); 34 static bool IsUsageSupported(Usage usage);
37 static bool IsConfigurationSupported(unsigned internalformat, unsigned usage); 35 static bool IsConfigurationSupported(Format format, Usage usage);
38 static int WindowFormat(unsigned internalformat); 36 static int WindowFormat(Format format);
39 37
40 // Overridden from gfx::GpuMemoryBuffer: 38 // Overridden from gfx::GpuMemoryBuffer:
41 virtual void* Map() override; 39 virtual void* Map() override;
42 virtual void Unmap() override; 40 virtual void Unmap() override;
43 virtual gfx::GpuMemoryBufferHandle GetHandle() const override; 41 virtual gfx::GpuMemoryBufferHandle GetHandle() const override;
44 virtual uint32 GetStride() const override; 42 virtual uint32 GetStride() const override;
45 43
46 private: 44 private:
47 GpuMemoryBufferImplSurfaceTexture(const gfx::Size& size, 45 GpuMemoryBufferImplSurfaceTexture(const gfx::Size& size,
48 unsigned internalformat, 46 Format format,
49 const DestructionCallback& callback, 47 const DestructionCallback& callback,
50 const gfx::GpuMemoryBufferId& id, 48 const gfx::GpuMemoryBufferId& id,
51 ANativeWindow* native_window); 49 ANativeWindow* native_window);
52 virtual ~GpuMemoryBufferImplSurfaceTexture(); 50 virtual ~GpuMemoryBufferImplSurfaceTexture();
53 51
54 gfx::GpuMemoryBufferId id_; 52 gfx::GpuMemoryBufferId id_;
55 ANativeWindow* native_window_; 53 ANativeWindow* native_window_;
56 size_t stride_; 54 size_t stride_;
57 55
58 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplSurfaceTexture); 56 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplSurfaceTexture);
59 }; 57 };
60 58
61 } // namespace content 59 } // namespace content
62 60
63 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ 61 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698