Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(319)

Side by Side Diff: gpu/ipc/client/command_buffer_proxy_impl.cc

Issue 1943513002: [Reland 1] Pepper takes ownership of a mailbox before passing it to the texture layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from sunnyps and piman. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/ipc/client/command_buffer_proxy_impl.h ('k') | gpu/ipc/common/gpu_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 // catches upwith the command buffer. 601 // catches upwith the command buffer.
602 // A malicious caller trying to create a collision by making next_signal_id 602 // A malicious caller trying to create a collision by making next_signal_id
603 // would have to make calls at an astounding rate (300B/s) and even if they 603 // would have to make calls at an astounding rate (300B/s) and even if they
604 // could do that, all they would do is to prevent some callbacks from getting 604 // could do that, all they would do is to prevent some callbacks from getting
605 // called, leading to stalled threads and/or memory leaks. 605 // called, leading to stalled threads and/or memory leaks.
606 uint32_t signal_id = next_signal_id_++; 606 uint32_t signal_id = next_signal_id_++;
607 Send(new GpuCommandBufferMsg_SignalQuery(route_id_, query, signal_id)); 607 Send(new GpuCommandBufferMsg_SignalQuery(route_id_, query, signal_id));
608 signal_tasks_.insert(std::make_pair(signal_id, callback)); 608 signal_tasks_.insert(std::make_pair(signal_id, callback));
609 } 609 }
610 610
611 bool CommandBufferProxyImpl::ProduceFrontBuffer(const gpu::Mailbox& mailbox) { 611 void CommandBufferProxyImpl::TakeFrontBuffer(const gpu::Mailbox& mailbox) {
612 CheckLock(); 612 CheckLock();
613 if (last_state_.error != gpu::error::kNoError) 613 if (last_state_.error != gpu::error::kNoError)
614 return false; 614 return;
615 615
616 Send(new GpuCommandBufferMsg_ProduceFrontBuffer(route_id_, mailbox)); 616 Send(new GpuCommandBufferMsg_TakeFrontBuffer(route_id_, mailbox));
617 return true; 617 }
618
619 void CommandBufferProxyImpl::ReturnFrontBuffer(const gpu::Mailbox& mailbox,
620 const gpu::SyncToken& sync_token,
621 bool is_lost) {
622 CheckLock();
623 if (last_state_.error != gpu::error::kNoError)
624 return;
625
626 Send(new GpuCommandBufferMsg_WaitSyncToken(route_id_, sync_token));
627 Send(new GpuCommandBufferMsg_ReturnFrontBuffer(route_id_, mailbox, is_lost));
618 } 628 }
619 629
620 gpu::error::Error CommandBufferProxyImpl::GetLastError() { 630 gpu::error::Error CommandBufferProxyImpl::GetLastError() {
621 return last_state_.error; 631 return last_state_.error;
622 } 632 }
623 633
624 bool CommandBufferProxyImpl::Send(IPC::Message* msg) { 634 bool CommandBufferProxyImpl::Send(IPC::Message* msg) {
625 // Caller should not intentionally send a message if the context is lost. 635 // Caller should not intentionally send a message if the context is lost.
626 DCHECK(last_state_.error == gpu::error::kNoError); 636 DCHECK(last_state_.error == gpu::error::kNoError);
627 DCHECK(channel_); 637 DCHECK(channel_);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 // the client for lost context a single time. 779 // the client for lost context a single time.
770 if (!channel_) 780 if (!channel_)
771 return; 781 return;
772 channel_->DestroyCommandBuffer(this); 782 channel_->DestroyCommandBuffer(this);
773 channel_ = nullptr; 783 channel_ = nullptr;
774 if (gpu_control_client_) 784 if (gpu_control_client_)
775 gpu_control_client_->OnGpuControlLostContext(); 785 gpu_control_client_->OnGpuControlLostContext();
776 } 786 }
777 787
778 } // namespace gpu 788 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/client/command_buffer_proxy_impl.h ('k') | gpu/ipc/common/gpu_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698