OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ |
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ |
7 | 7 |
| 8 #include <string> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/callback.h" | 11 #include "base/callback.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
13 #include "ui/gfx/gpu_memory_buffer.h" | 14 #include "ui/gfx/gpu_memory_buffer.h" |
14 #include "ui/gfx/size.h" | 15 #include "ui/gfx/size.h" |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 | 18 |
18 // Provides common implementation of a GPU memory buffer. | 19 // Provides common implementation of a GPU memory buffer. |
19 class CONTENT_EXPORT GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer { | 20 class CONTENT_EXPORT GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer { |
20 public: | 21 public: |
21 typedef base::Callback<void(scoped_ptr<GpuMemoryBufferImpl> buffer)> | 22 typedef base::Callback<void(scoped_ptr<GpuMemoryBufferImpl> buffer)> |
22 CreationCallback; | 23 CreationCallback; |
23 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> | 24 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> |
24 AllocationCallback; | 25 AllocationCallback; |
25 typedef base::Callback<void(uint32 sync_point)> DestructionCallback; | 26 typedef base::Callback<void(uint32 sync_point)> DestructionCallback; |
26 | 27 |
27 ~GpuMemoryBufferImpl() override; | 28 ~GpuMemoryBufferImpl() override; |
28 | 29 |
| 30 // Gets the GPU memory buffer type with a given name. |
| 31 static gfx::GpuMemoryBufferType GetNamedType(const std::string& name); |
| 32 |
| 33 // Gets the name of a GPU memory buffer type. |
| 34 static const char* GetTypeName(gfx::GpuMemoryBufferType type); |
| 35 |
29 // Gets system supported GPU memory buffer types. Preferred type at the front | 36 // Gets system supported GPU memory buffer types. Preferred type at the front |
30 // of vector. | 37 // of vector. |
31 static void GetSupportedTypes(std::vector<gfx::GpuMemoryBufferType>* types); | 38 static void GetSupportedTypes(std::vector<gfx::GpuMemoryBufferType>* types); |
32 | 39 |
33 // Sets the preferred GPU memory buffer type. This overrides the default | 40 // Sets the preferred GPU memory buffer type. This overrides the default |
34 // preferred type. Can only be called once prior to GetPreferredType(). | 41 // preferred type. Can only be called once prior to GetPreferredType(). |
35 // Caller is responsible for correct ordering. | 42 // Caller is responsible for correct ordering. |
36 static void SetPreferredType(gfx::GpuMemoryBufferType type); | 43 static void SetPreferredType(gfx::GpuMemoryBufferType type); |
37 | 44 |
38 // Gets the preferred discardable memory type. | 45 // Gets the preferred discardable memory type. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 bool mapped_; | 119 bool mapped_; |
113 uint32 destruction_sync_point_; | 120 uint32 destruction_sync_point_; |
114 | 121 |
115 private: | 122 private: |
116 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); | 123 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); |
117 }; | 124 }; |
118 | 125 |
119 } // namespace content | 126 } // namespace content |
120 | 127 |
121 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ | 128 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ |
OLD | NEW |