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 "content/common/gpu/gpu_channel_manager.h" | 5 #include "content/common/gpu/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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 GpuMemoryBufferFactory* gpu_memory_buffer_factory) | 53 GpuMemoryBufferFactory* gpu_memory_buffer_factory) |
54 : task_runner_(task_runner), | 54 : task_runner_(task_runner), |
55 io_task_runner_(io_task_runner), | 55 io_task_runner_(io_task_runner), |
56 channel_(channel), | 56 channel_(channel), |
57 watchdog_(watchdog), | 57 watchdog_(watchdog), |
58 shutdown_event_(shutdown_event), | 58 shutdown_event_(shutdown_event), |
59 share_group_(new gfx::GLShareGroup), | 59 share_group_(new gfx::GLShareGroup), |
60 mailbox_manager_(gpu::gles2::MailboxManager::Create()), | 60 mailbox_manager_(gpu::gles2::MailboxManager::Create()), |
61 gpu_memory_manager_(this), | 61 gpu_memory_manager_(this), |
62 sync_point_manager_(sync_point_manager), | 62 sync_point_manager_(sync_point_manager), |
63 sync_point_client_waiter_(new gpu::SyncPointClientWaiter), | 63 sync_point_client_waiter_( |
| 64 sync_point_manager->CreateSyncPointClientWaiter()), |
64 gpu_memory_buffer_factory_(gpu_memory_buffer_factory), | 65 gpu_memory_buffer_factory_(gpu_memory_buffer_factory), |
65 weak_factory_(this) { | 66 weak_factory_(this) { |
66 DCHECK(task_runner); | 67 DCHECK(task_runner); |
67 DCHECK(io_task_runner); | 68 DCHECK(io_task_runner); |
68 const base::CommandLine* command_line = | 69 const base::CommandLine* command_line = |
69 base::CommandLine::ForCurrentProcess(); | 70 base::CommandLine::ForCurrentProcess(); |
70 if (command_line->HasSwitch(switches::kUIPrioritizeInGpuProcess)) | 71 if (command_line->HasSwitch(switches::kUIPrioritizeInGpuProcess)) |
71 preemption_flag_ = new gpu::PreemptionFlag; | 72 preemption_flag_ = new gpu::PreemptionFlag; |
72 } | 73 } |
73 | 74 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 228 |
228 void GpuChannelManager::OnDestroyGpuMemoryBuffer( | 229 void GpuChannelManager::OnDestroyGpuMemoryBuffer( |
229 gfx::GpuMemoryBufferId id, | 230 gfx::GpuMemoryBufferId id, |
230 int client_id, | 231 int client_id, |
231 const gpu::SyncToken& sync_token) { | 232 const gpu::SyncToken& sync_token) { |
232 if (sync_token.HasData()) { | 233 if (sync_token.HasData()) { |
233 scoped_refptr<gpu::SyncPointClientState> release_state = | 234 scoped_refptr<gpu::SyncPointClientState> release_state = |
234 sync_point_manager()->GetSyncPointClientState( | 235 sync_point_manager()->GetSyncPointClientState( |
235 sync_token.namespace_id(), sync_token.command_buffer_id()); | 236 sync_token.namespace_id(), sync_token.command_buffer_id()); |
236 if (release_state) { | 237 if (release_state) { |
237 sync_point_client_waiter_->Wait( | 238 sync_point_client_waiter_->WaitOutOfOrder( |
238 release_state.get(), sync_token.release_count(), | 239 release_state.get(), sync_token.release_count(), |
239 base::Bind(&GpuChannelManager::DestroyGpuMemoryBuffer, | 240 base::Bind(&GpuChannelManager::DestroyGpuMemoryBuffer, |
240 base::Unretained(this), id, client_id)); | 241 base::Unretained(this), id, client_id)); |
241 return; | 242 return; |
242 } | 243 } |
243 } | 244 } |
244 | 245 |
245 // No sync token or invalid sync token, destroy immediately. | 246 // No sync token or invalid sync token, destroy immediately. |
246 DestroyGpuMemoryBuffer(id, client_id); | 247 DestroyGpuMemoryBuffer(id, client_id); |
247 } | 248 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 } | 341 } |
341 } | 342 } |
342 if (!stub || !stub->decoder()->MakeCurrent()) | 343 if (!stub || !stub->decoder()->MakeCurrent()) |
343 return; | 344 return; |
344 glFinish(); | 345 glFinish(); |
345 DidAccessGpu(); | 346 DidAccessGpu(); |
346 } | 347 } |
347 #endif | 348 #endif |
348 | 349 |
349 } // namespace content | 350 } // namespace content |
OLD | NEW |