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

Side by Side Diff: content/browser/gpu/browser_gpu_memory_buffer_manager.h

Issue 1389133002: content: Use type-parameterized tests for GpuMemoryBuffer implementations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add blankline Created 5 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
« no previous file with comments | « no previous file | content/browser/gpu/browser_gpu_memory_buffer_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ 5 #ifndef CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_
6 #define CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ 6 #define CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_
7 7
8 #include <vector> 8 #include <utility>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/containers/hash_tables.h"
11 #include "base/trace_event/memory_dump_provider.h" 12 #include "base/trace_event/memory_dump_provider.h"
12 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
13 #include "content/common/gpu/gpu_memory_buffer_factory.h"
14 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" 14 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
15 15
16 namespace content { 16 namespace content {
17 17
18 using GpuMemoryBufferConfigurationKey =
19 std::pair<gfx::BufferFormat, gfx::BufferUsage>;
20 using GpuMemoryBufferConfigurationSet =
21 base::hash_set<GpuMemoryBufferConfigurationKey>;
22
23 } // content
24
25 namespace BASE_HASH_NAMESPACE {
26
27 template <>
28 struct hash<content::GpuMemoryBufferConfigurationKey> {
29 size_t operator()(const content::GpuMemoryBufferConfigurationKey& key) const {
30 return base::HashPair(static_cast<int>(key.first),
31 static_cast<int>(key.second));
32 }
33 };
34
35 } // namespace BASE_HASH_NAMESPACE
36
37 namespace content {
38
18 class CONTENT_EXPORT BrowserGpuMemoryBufferManager 39 class CONTENT_EXPORT BrowserGpuMemoryBufferManager
19 : public gpu::GpuMemoryBufferManager, 40 : public gpu::GpuMemoryBufferManager,
20 public base::trace_event::MemoryDumpProvider { 41 public base::trace_event::MemoryDumpProvider {
21 public: 42 public:
22 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> 43 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)>
23 AllocationCallback; 44 AllocationCallback;
24 45
25 BrowserGpuMemoryBufferManager(int gpu_client_id, 46 BrowserGpuMemoryBufferManager(int gpu_client_id,
26 uint64_t gpu_client_tracing_id); 47 uint64_t gpu_client_tracing_id);
27 ~BrowserGpuMemoryBufferManager() override; 48 ~BrowserGpuMemoryBufferManager() override;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 gfx::BufferUsage usage; 111 gfx::BufferUsage usage;
91 int gpu_host_id; 112 int gpu_host_id;
92 }; 113 };
93 struct AllocateGpuMemoryBufferRequest; 114 struct AllocateGpuMemoryBufferRequest;
94 115
95 scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBufferForSurface( 116 scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBufferForSurface(
96 const gfx::Size& size, 117 const gfx::Size& size,
97 gfx::BufferFormat format, 118 gfx::BufferFormat format,
98 gfx::BufferUsage usage, 119 gfx::BufferUsage usage,
99 int32 surface_id); 120 int32 surface_id);
100 bool IsGpuMemoryBufferConfigurationSupported(gfx::BufferFormat format, 121 bool IsNativeGpuMemoryBufferConfiguration(gfx::BufferFormat format,
101 gfx::BufferUsage usage) const; 122 gfx::BufferUsage usage) const;
102 void AllocateGpuMemoryBufferForSurfaceOnIO( 123 void AllocateGpuMemoryBufferForSurfaceOnIO(
103 AllocateGpuMemoryBufferRequest* request); 124 AllocateGpuMemoryBufferRequest* request);
104 void GpuMemoryBufferAllocatedForSurfaceOnIO( 125 void GpuMemoryBufferAllocatedForSurfaceOnIO(
105 AllocateGpuMemoryBufferRequest* request, 126 AllocateGpuMemoryBufferRequest* request,
106 const gfx::GpuMemoryBufferHandle& handle); 127 const gfx::GpuMemoryBufferHandle& handle);
107 void AllocateGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, 128 void AllocateGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id,
108 const gfx::Size& size, 129 const gfx::Size& size,
109 gfx::BufferFormat format, 130 gfx::BufferFormat format,
110 gfx::BufferUsage usage, 131 gfx::BufferUsage usage,
111 int client_id, 132 int client_id,
112 int surface_id, 133 int surface_id,
113 bool reused_gpu_process, 134 bool reused_gpu_process,
114 const AllocationCallback& callback); 135 const AllocationCallback& callback);
115 void GpuMemoryBufferAllocatedOnIO(gfx::GpuMemoryBufferId id, 136 void GpuMemoryBufferAllocatedOnIO(gfx::GpuMemoryBufferId id,
116 int client_id, 137 int client_id,
117 int surface_id, 138 int surface_id,
118 int gpu_host_id, 139 int gpu_host_id,
119 bool reused_gpu_process, 140 bool reused_gpu_process,
120 const AllocationCallback& callback, 141 const AllocationCallback& callback,
121 const gfx::GpuMemoryBufferHandle& handle); 142 const gfx::GpuMemoryBufferHandle& handle);
122 void DestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, 143 void DestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id,
123 int client_id, 144 int client_id,
124 uint32 sync_point); 145 uint32 sync_point);
125 146
126 uint64_t ClientIdToTracingProcessId(int client_id) const; 147 uint64_t ClientIdToTracingProcessId(int client_id) const;
127 148
128 const gfx::GpuMemoryBufferType factory_type_; 149 const GpuMemoryBufferConfigurationSet native_configurations_;
129 const std::vector<GpuMemoryBufferFactory::Configuration>
130 supported_configurations_;
131 const int gpu_client_id_; 150 const int gpu_client_id_;
132 const uint64_t gpu_client_tracing_id_; 151 const uint64_t gpu_client_tracing_id_;
133 152
134 // The GPU process host ID. This should only be accessed on the IO thread. 153 // The GPU process host ID. This should only be accessed on the IO thread.
135 int gpu_host_id_; 154 int gpu_host_id_;
136 155
137 // Stores info about buffers for all clients. This should only be accessed 156 // Stores info about buffers for all clients. This should only be accessed
138 // on the IO thread. 157 // on the IO thread.
139 using BufferMap = base::hash_map<gfx::GpuMemoryBufferId, BufferInfo>; 158 using BufferMap = base::hash_map<gfx::GpuMemoryBufferId, BufferInfo>;
140 using ClientMap = base::hash_map<int, BufferMap>; 159 using ClientMap = base::hash_map<int, BufferMap>;
141 ClientMap clients_; 160 ClientMap clients_;
142 161
143 DISALLOW_COPY_AND_ASSIGN(BrowserGpuMemoryBufferManager); 162 DISALLOW_COPY_AND_ASSIGN(BrowserGpuMemoryBufferManager);
144 }; 163 };
145 164
146 } // namespace content 165 } // namespace content
147 166
148 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ 167 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/gpu/browser_gpu_memory_buffer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698