OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/mus/gles2/command_buffer_local.h" | 5 #include "components/mus/gles2/command_buffer_local.h" |
6 | 6 |
7 #include "base/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
319 base::Unretained(this), sync_point)); | 319 base::Unretained(this), sync_point)); |
320 } | 320 } |
321 | 321 |
322 void CommandBufferLocal::SignalSyncPoint(uint32_t sync_point, | 322 void CommandBufferLocal::SignalSyncPoint(uint32_t sync_point, |
323 const base::Closure& callback) { | 323 const base::Closure& callback) { |
324 DCHECK(CalledOnValidThread()); | 324 DCHECK(CalledOnValidThread()); |
325 gpu_state_->sync_point_manager()->AddSyncPointCallback(sync_point, | 325 gpu_state_->sync_point_manager()->AddSyncPointCallback(sync_point, |
326 base::Bind(&PostTask, client_thread_task_runner_, callback)); | 326 base::Bind(&PostTask, client_thread_task_runner_, callback)); |
327 } | 327 } |
328 | 328 |
329 void CommandBufferLocal::SignalQuery(uint32_t query, | 329 void CommandBufferLocal::SignalQuery(uint32_t query_id, |
330 const base::Closure& callback) { | 330 const base::Closure& callback) { |
331 DCHECK(CalledOnValidThread()); | 331 DCHECK(CalledOnValidThread()); |
332 // TODO(piman) | 332 |
333 NOTIMPLEMENTED(); | 333 gpu_state_->command_buffer_task_runner()->PostTask( |
334 driver_.get(), base::Bind(&CommandBufferLocal::SignalQueryOnGpuThread, | |
335 base::Unretained(this), query_id, callback)); | |
334 } | 336 } |
335 | 337 |
336 void CommandBufferLocal::SetLock(base::Lock* lock) { | 338 void CommandBufferLocal::SetLock(base::Lock* lock) { |
337 DCHECK(CalledOnValidThread()); | 339 DCHECK(CalledOnValidThread()); |
338 NOTIMPLEMENTED(); | 340 NOTIMPLEMENTED(); |
339 } | 341 } |
340 | 342 |
341 bool CommandBufferLocal::IsGpuChannelLost() { | 343 bool CommandBufferLocal::IsGpuChannelLost() { |
342 DCHECK(CalledOnValidThread()); | 344 DCHECK(CalledOnValidThread()); |
343 // This is only possible for out-of-process command buffers. | 345 // This is only possible for out-of-process command buffers. |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
544 *state = driver_->GetLastState(); | 546 *state = driver_->GetLastState(); |
545 event->Signal(); | 547 event->Signal(); |
546 return true; | 548 return true; |
547 } | 549 } |
548 | 550 |
549 bool CommandBufferLocal::DeleteOnGpuThread() { | 551 bool CommandBufferLocal::DeleteOnGpuThread() { |
550 delete this; | 552 delete this; |
551 return true; | 553 return true; |
552 } | 554 } |
553 | 555 |
556 bool CommandBufferLocal::SignalQueryOnGpuThread(uint32_t query_id, | |
557 const base::Closure& callback) { | |
558 driver_->SignalQuery(query_id, callback); | |
Peng
2016/01/20 22:27:29
You must make sure the callback is called on the c
Hadi
2016/01/21 15:46:27
Done.
| |
559 return true; | |
560 } | |
561 | |
554 void CommandBufferLocal::DidLoseContextOnClientThread(uint32_t reason) { | 562 void CommandBufferLocal::DidLoseContextOnClientThread(uint32_t reason) { |
555 if (client_) | 563 if (client_) |
556 client_->DidLoseContext(); | 564 client_->DidLoseContext(); |
557 } | 565 } |
558 | 566 |
559 void CommandBufferLocal::UpdateVSyncParametersOnClientThread(int64_t timebase, | 567 void CommandBufferLocal::UpdateVSyncParametersOnClientThread(int64_t timebase, |
560 int64_t interval) { | 568 int64_t interval) { |
561 if (client_) | 569 if (client_) |
562 client_->UpdateVSyncParameters(timebase, interval); | 570 client_->UpdateVSyncParameters(timebase, interval); |
563 } | 571 } |
564 | 572 |
565 } // namespace mus | 573 } // namespace mus |
OLD | NEW |