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

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: Add a test. 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
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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 // catches upwith the command buffer. 611 // catches upwith the command buffer.
612 // A malicious caller trying to create a collision by making next_signal_id 612 // A malicious caller trying to create a collision by making next_signal_id
613 // would have to make calls at an astounding rate (300B/s) and even if they 613 // would have to make calls at an astounding rate (300B/s) and even if they
614 // could do that, all they would do is to prevent some callbacks from getting 614 // could do that, all they would do is to prevent some callbacks from getting
615 // called, leading to stalled threads and/or memory leaks. 615 // called, leading to stalled threads and/or memory leaks.
616 uint32_t signal_id = next_signal_id_++; 616 uint32_t signal_id = next_signal_id_++;
617 Send(new GpuCommandBufferMsg_SignalQuery(route_id_, query, signal_id)); 617 Send(new GpuCommandBufferMsg_SignalQuery(route_id_, query, signal_id));
618 signal_tasks_.insert(std::make_pair(signal_id, callback)); 618 signal_tasks_.insert(std::make_pair(signal_id, callback));
619 } 619 }
620 620
621 bool CommandBufferProxyImpl::ProduceFrontBuffer(const gpu::Mailbox& mailbox) { 621 void CommandBufferProxyImpl::TakeFrontBuffer(const gpu::Mailbox& mailbox) {
622 CheckLock(); 622 CheckLock();
623 if (last_state_.error != gpu::error::kNoError) 623 if (last_state_.error != gpu::error::kNoError)
624 return false; 624 return;
625 625
626 Send(new GpuCommandBufferMsg_ProduceFrontBuffer(route_id_, mailbox)); 626 Send(new GpuCommandBufferMsg_TakeFrontBuffer(route_id_, mailbox));
627 return true; 627 }
628
629 void CommandBufferProxyImpl::ReturnFrontBuffer(const gpu::Mailbox& mailbox,
630 const gpu::SyncToken& sync_token,
631 bool is_lost) {
632 CheckLock();
633 if (last_state_.error != gpu::error::kNoError)
634 return;
635
636 Send(new GpuCommandBufferMsg_ReturnFrontBuffer(route_id_, mailbox, sync_token,
637 is_lost));
628 } 638 }
629 639
630 gpu::error::Error CommandBufferProxyImpl::GetLastError() { 640 gpu::error::Error CommandBufferProxyImpl::GetLastError() {
631 return last_state_.error; 641 return last_state_.error;
632 } 642 }
633 643
634 bool CommandBufferProxyImpl::Send(IPC::Message* msg) { 644 bool CommandBufferProxyImpl::Send(IPC::Message* msg) {
635 // Caller should not intentionally send a message if the context is lost. 645 // Caller should not intentionally send a message if the context is lost.
636 DCHECK(last_state_.error == gpu::error::kNoError); 646 DCHECK(last_state_.error == gpu::error::kNoError);
637 DCHECK(channel_); 647 DCHECK(channel_);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 } 730 }
721 731
722 void CommandBufferProxyImpl::InvalidGpuReplyOnClientThread() { 732 void CommandBufferProxyImpl::InvalidGpuReplyOnClientThread() {
723 std::unique_ptr<base::AutoLock> lock; 733 std::unique_ptr<base::AutoLock> lock;
724 if (lock_) 734 if (lock_)
725 lock.reset(new base::AutoLock(*lock_)); 735 lock.reset(new base::AutoLock(*lock_));
726 OnDestroyed(gpu::error::kInvalidGpuMessage, gpu::error::kLostContext); 736 OnDestroyed(gpu::error::kInvalidGpuMessage, gpu::error::kLostContext);
727 } 737 }
728 738
729 } // namespace gpu 739 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698