Chromium Code Reviews| 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/client/command_buffer_proxy_impl.h" | 5 #include "gpu/ipc/client/command_buffer_proxy_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 610 // catches upwith the command buffer. | 610 // catches upwith the command buffer. |
| 611 // A malicious caller trying to create a collision by making next_signal_id | 611 // A malicious caller trying to create a collision by making next_signal_id |
| 612 // would have to make calls at an astounding rate (300B/s) and even if they | 612 // would have to make calls at an astounding rate (300B/s) and even if they |
| 613 // could do that, all they would do is to prevent some callbacks from getting | 613 // could do that, all they would do is to prevent some callbacks from getting |
| 614 // called, leading to stalled threads and/or memory leaks. | 614 // called, leading to stalled threads and/or memory leaks. |
| 615 uint32_t signal_id = next_signal_id_++; | 615 uint32_t signal_id = next_signal_id_++; |
| 616 Send(new GpuCommandBufferMsg_SignalQuery(route_id_, query, signal_id)); | 616 Send(new GpuCommandBufferMsg_SignalQuery(route_id_, query, signal_id)); |
| 617 signal_tasks_.insert(std::make_pair(signal_id, callback)); | 617 signal_tasks_.insert(std::make_pair(signal_id, callback)); |
| 618 } | 618 } |
| 619 | 619 |
| 620 bool CommandBufferProxyImpl::ProduceFrontBuffer(const gpu::Mailbox& mailbox) { | 620 void CommandBufferProxyImpl::TakeFrontBuffer(const gpu::Mailbox& mailbox) { |
|
piman
2016/04/27 23:00:58
nit: CheckLock();
erikchen
2016/04/27 23:59:24
Done
piman
2016/04/28 02:15:05
I don't see it in the latest PS (PS#18)
erikchen
2016/04/28 17:07:23
I do see it.
https://codereview.chromium.org/19128
| |
| 621 CheckLock(); | |
| 622 if (last_state_.error != gpu::error::kNoError) | 621 if (last_state_.error != gpu::error::kNoError) |
| 623 return false; | 622 return; |
| 624 | 623 |
| 625 Send(new GpuCommandBufferMsg_ProduceFrontBuffer(route_id_, mailbox)); | 624 Send(new GpuCommandBufferMsg_TakeFrontBuffer(route_id_, mailbox)); |
| 626 return true; | 625 } |
| 626 | |
| 627 void CommandBufferProxyImpl::ReturnFrontBuffer(const gpu::Mailbox& mailbox, | |
| 628 const gpu::SyncToken& sync_token, | |
| 629 bool is_lost) { | |
|
piman
2016/04/27 23:00:58
nit: CheckLock();
erikchen
2016/04/27 23:59:24
Done.
piman
2016/04/28 02:15:05
ditto
| |
| 630 if (last_state_.error != gpu::error::kNoError) | |
| 631 return; | |
| 632 | |
| 633 Send(new GpuCommandBufferMsg_ReturnFrontBuffer(route_id_, mailbox, sync_token, | |
| 634 is_lost)); | |
| 627 } | 635 } |
| 628 | 636 |
| 629 gpu::error::Error CommandBufferProxyImpl::GetLastError() { | 637 gpu::error::Error CommandBufferProxyImpl::GetLastError() { |
| 630 return last_state_.error; | 638 return last_state_.error; |
| 631 } | 639 } |
| 632 | 640 |
| 633 bool CommandBufferProxyImpl::Send(IPC::Message* msg) { | 641 bool CommandBufferProxyImpl::Send(IPC::Message* msg) { |
| 634 // Caller should not intentionally send a message if the context is lost. | 642 // Caller should not intentionally send a message if the context is lost. |
| 635 DCHECK(last_state_.error == gpu::error::kNoError); | 643 DCHECK(last_state_.error == gpu::error::kNoError); |
| 636 DCHECK(channel_); | 644 DCHECK(channel_); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 719 } | 727 } |
| 720 | 728 |
| 721 void CommandBufferProxyImpl::InvalidGpuReplyOnClientThread() { | 729 void CommandBufferProxyImpl::InvalidGpuReplyOnClientThread() { |
| 722 std::unique_ptr<base::AutoLock> lock; | 730 std::unique_ptr<base::AutoLock> lock; |
| 723 if (lock_) | 731 if (lock_) |
| 724 lock.reset(new base::AutoLock(*lock_)); | 732 lock.reset(new base::AutoLock(*lock_)); |
| 725 OnDestroyed(gpu::error::kInvalidGpuMessage, gpu::error::kLostContext); | 733 OnDestroyed(gpu::error::kInvalidGpuMessage, gpu::error::kLostContext); |
| 726 } | 734 } |
| 727 | 735 |
| 728 } // namespace gpu | 736 } // namespace gpu |
| OLD | NEW |