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

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

Issue 263553009: content: Cleanup GpuMemoryBuffer allocation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mac build fix Created 6 years, 7 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 | Annotate | Revision Log
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 // Provides implementation of a GPU memory buffer based on a surface texture id. 14 // Implementation of GPU memory buffer based on SurfaceTextures.
15 class GpuMemoryBufferImplSurfaceTexture : public GpuMemoryBufferImpl { 15 class GpuMemoryBufferImplSurfaceTexture : public GpuMemoryBufferImpl {
16 public: 16 public:
17 GpuMemoryBufferImplSurfaceTexture(gfx::Size size, unsigned internalformat); 17 GpuMemoryBufferImplSurfaceTexture(const gfx::Size& size,
18 unsigned internalformat);
18 virtual ~GpuMemoryBufferImplSurfaceTexture(); 19 virtual ~GpuMemoryBufferImplSurfaceTexture();
19 20
20 bool Initialize(gfx::GpuMemoryBufferHandle handle);
21
22 static bool IsFormatSupported(unsigned internalformat); 21 static bool IsFormatSupported(unsigned internalformat);
23 static bool IsUsageSupported(unsigned usage); 22 static bool IsUsageSupported(unsigned usage);
23 static bool IsConfigurationSupported(unsigned internalformat, unsigned usage);
24 static int WindowFormat(unsigned internalformat); 24 static int WindowFormat(unsigned internalformat);
25 25
26 bool InitializeFromHandle(gfx::GpuMemoryBufferHandle handle);
27
26 // Overridden from gfx::GpuMemoryBuffer: 28 // Overridden from gfx::GpuMemoryBuffer:
27 virtual void* Map() OVERRIDE; 29 virtual void* Map() OVERRIDE;
28 virtual void Unmap() OVERRIDE; 30 virtual void Unmap() OVERRIDE;
29 virtual gfx::GpuMemoryBufferHandle GetHandle() const OVERRIDE; 31 virtual gfx::GpuMemoryBufferHandle GetHandle() const OVERRIDE;
30 virtual uint32 GetStride() const OVERRIDE; 32 virtual uint32 GetStride() const OVERRIDE;
31 33
32 private: 34 private:
33 gfx::SurfaceTextureId surface_texture_id_; 35 gfx::SurfaceTextureId surface_texture_id_;
34 ANativeWindow* native_window_; 36 ANativeWindow* native_window_;
35 size_t stride_; 37 size_t stride_;
36 38
37 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplSurfaceTexture); 39 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplSurfaceTexture);
38 }; 40 };
39 41
40 } // namespace content 42 } // namespace content
41 43
42 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ 44 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698