| 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) { |
| 621 CheckLock(); | 621 CheckLock(); |
| 622 if (last_state_.error != gpu::error::kNoError) | 622 if (last_state_.error != gpu::error::kNoError) |
| 623 return false; | 623 return; |
| 624 | 624 |
| 625 Send(new GpuCommandBufferMsg_ProduceFrontBuffer(route_id_, mailbox)); | 625 Send(new GpuCommandBufferMsg_TakeFrontBuffer(route_id_, mailbox)); |
| 626 return true; | 626 } |
| 627 |
| 628 void CommandBufferProxyImpl::ReturnFrontBuffer(const gpu::Mailbox& mailbox, |
| 629 const gpu::SyncToken& sync_token, |
| 630 bool is_lost) { |
| 631 CheckLock(); |
| 632 if (last_state_.error != gpu::error::kNoError) |
| 633 return; |
| 634 |
| 635 Send(new GpuCommandBufferMsg_ReturnFrontBuffer(route_id_, mailbox, sync_token, |
| 636 is_lost)); |
| 627 } | 637 } |
| 628 | 638 |
| 629 gpu::error::Error CommandBufferProxyImpl::GetLastError() { | 639 gpu::error::Error CommandBufferProxyImpl::GetLastError() { |
| 630 return last_state_.error; | 640 return last_state_.error; |
| 631 } | 641 } |
| 632 | 642 |
| 633 bool CommandBufferProxyImpl::Send(IPC::Message* msg) { | 643 bool CommandBufferProxyImpl::Send(IPC::Message* msg) { |
| 634 // Caller should not intentionally send a message if the context is lost. | 644 // Caller should not intentionally send a message if the context is lost. |
| 635 DCHECK(last_state_.error == gpu::error::kNoError); | 645 DCHECK(last_state_.error == gpu::error::kNoError); |
| 636 DCHECK(channel_); | 646 DCHECK(channel_); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 } | 729 } |
| 720 | 730 |
| 721 void CommandBufferProxyImpl::InvalidGpuReplyOnClientThread() { | 731 void CommandBufferProxyImpl::InvalidGpuReplyOnClientThread() { |
| 722 std::unique_ptr<base::AutoLock> lock; | 732 std::unique_ptr<base::AutoLock> lock; |
| 723 if (lock_) | 733 if (lock_) |
| 724 lock.reset(new base::AutoLock(*lock_)); | 734 lock.reset(new base::AutoLock(*lock_)); |
| 725 OnDestroyed(gpu::error::kInvalidGpuMessage, gpu::error::kLostContext); | 735 OnDestroyed(gpu::error::kInvalidGpuMessage, gpu::error::kLostContext); |
| 726 } | 736 } |
| 727 | 737 |
| 728 } // namespace gpu | 738 } // namespace gpu |
| OLD | NEW |