OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "gpu/ipc/service/gpu_channel_manager.h" | 5 #include "gpu/ipc/service/gpu_channel_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // No sync token or invalid sync token, destroy immediately. | 179 // No sync token or invalid sync token, destroy immediately. |
180 InternalDestroyGpuMemoryBuffer(id, client_id); | 180 InternalDestroyGpuMemoryBuffer(id, client_id); |
181 } | 181 } |
182 } | 182 } |
183 | 183 |
184 void GpuChannelManager::PopulateShaderCache(const std::string& program_proto) { | 184 void GpuChannelManager::PopulateShaderCache(const std::string& program_proto) { |
185 if (program_cache()) | 185 if (program_cache()) |
186 program_cache()->LoadProgram(program_proto); | 186 program_cache()->LoadProgram(program_proto); |
187 } | 187 } |
188 | 188 |
189 uint32_t GpuChannelManager::GetUnprocessedOrderNum() const { | |
190 uint32_t unprocessed_order_num = 0; | |
191 for (auto& kv : gpu_channels_) { | |
192 unprocessed_order_num = | |
193 std::max(unprocessed_order_num, kv.second->GetUnprocessedOrderNum()); | |
194 } | |
195 return unprocessed_order_num; | |
196 } | |
197 | |
198 uint32_t GpuChannelManager::GetProcessedOrderNum() const { | |
199 uint32_t processed_order_num = 0; | |
200 for (auto& kv : gpu_channels_) { | |
201 processed_order_num = | |
202 std::max(processed_order_num, kv.second->GetProcessedOrderNum()); | |
203 } | |
204 return processed_order_num; | |
205 } | |
206 | |
207 void GpuChannelManager::LoseAllContexts() { | 189 void GpuChannelManager::LoseAllContexts() { |
208 for (auto& kv : gpu_channels_) { | 190 for (auto& kv : gpu_channels_) { |
209 kv.second->MarkAllContextsLost(); | 191 kv.second->MarkAllContextsLost(); |
210 } | 192 } |
211 task_runner_->PostTask(FROM_HERE, | 193 task_runner_->PostTask(FROM_HERE, |
212 base::Bind(&GpuChannelManager::DestroyAllChannels, | 194 base::Bind(&GpuChannelManager::DestroyAllChannels, |
213 weak_factory_.GetWeakPtr())); | 195 weak_factory_.GetWeakPtr())); |
214 } | 196 } |
215 | 197 |
216 void GpuChannelManager::MaybeExitOnContextLost() { | 198 void GpuChannelManager::MaybeExitOnContextLost() { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 } | 259 } |
278 } | 260 } |
279 if (!stub || !stub->decoder()->MakeCurrent()) | 261 if (!stub || !stub->decoder()->MakeCurrent()) |
280 return; | 262 return; |
281 glFinish(); | 263 glFinish(); |
282 DidAccessGpu(); | 264 DidAccessGpu(); |
283 } | 265 } |
284 #endif | 266 #endif |
285 | 267 |
286 } // namespace gpu | 268 } // namespace gpu |
OLD | NEW |