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

Side by Side Diff: gpu/ipc/service/gpu_command_buffer_stub.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
« no previous file with comments | « gpu/ipc/service/gpu_command_buffer_stub.h ('k') | ppapi/proxy/ppapi_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/service/gpu_command_buffer_stub.h" 5 #include "gpu/ipc/service/gpu_command_buffer_stub.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } 288 }
289 289
290 // Always use IPC_MESSAGE_HANDLER_DELAY_REPLY for synchronous message handlers 290 // Always use IPC_MESSAGE_HANDLER_DELAY_REPLY for synchronous message handlers
291 // here. This is so the reply can be delayed if the scheduler is unscheduled. 291 // here. This is so the reply can be delayed if the scheduler is unscheduled.
292 bool handled = true; 292 bool handled = true;
293 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message) 293 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message)
294 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Initialize, 294 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Initialize,
295 OnInitialize); 295 OnInitialize);
296 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetGetBuffer, 296 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetGetBuffer,
297 OnSetGetBuffer); 297 OnSetGetBuffer);
298 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ProduceFrontBuffer, 298 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_TakeFrontBuffer, OnTakeFrontBuffer);
299 OnProduceFrontBuffer); 299 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ReturnFrontBuffer,
300 OnReturnFrontBuffer);
300 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_WaitForTokenInRange, 301 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_WaitForTokenInRange,
301 OnWaitForTokenInRange); 302 OnWaitForTokenInRange);
302 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_WaitForGetOffsetInRange, 303 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_WaitForGetOffsetInRange,
303 OnWaitForGetOffsetInRange); 304 OnWaitForGetOffsetInRange);
304 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush); 305 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush);
305 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RegisterTransferBuffer, 306 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RegisterTransferBuffer,
306 OnRegisterTransferBuffer); 307 OnRegisterTransferBuffer);
307 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer, 308 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer,
308 OnDestroyTransferBuffer); 309 OnDestroyTransferBuffer);
309 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncToken, 310 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncToken,
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 } 708 }
708 709
709 void GpuCommandBufferStub::OnSetGetBuffer(int32_t shm_id, 710 void GpuCommandBufferStub::OnSetGetBuffer(int32_t shm_id,
710 IPC::Message* reply_message) { 711 IPC::Message* reply_message) {
711 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetGetBuffer"); 712 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetGetBuffer");
712 if (command_buffer_) 713 if (command_buffer_)
713 command_buffer_->SetGetBuffer(shm_id); 714 command_buffer_->SetGetBuffer(shm_id);
714 Send(reply_message); 715 Send(reply_message);
715 } 716 }
716 717
717 void GpuCommandBufferStub::OnProduceFrontBuffer(const Mailbox& mailbox) { 718 void GpuCommandBufferStub::OnTakeFrontBuffer(const Mailbox& mailbox) {
718 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnProduceFrontBuffer"); 719 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnTakeFrontBuffer");
719 if (!decoder_) { 720 if (!decoder_) {
720 LOG(ERROR) << "Can't produce front buffer before initialization."; 721 LOG(ERROR) << "Can't take front buffer before initialization.";
721 return; 722 return;
722 } 723 }
723 724
724 decoder_->ProduceFrontBuffer(mailbox); 725 decoder_->TakeFrontBuffer(mailbox);
726 }
727
728 void GpuCommandBufferStub::OnReturnFrontBuffer(const Mailbox& mailbox,
729 const SyncToken& sync_token,
730 bool is_lost) {
731 OnWaitFenceSync(sync_token.namespace_id(), sync_token.command_buffer_id(),
732 sync_token.release_count());
piman 2016/05/03 02:52:04 Oh, duh, sorry I missed this. OnWaitFenceSync can'
erikchen 2016/05/03 17:24:14 Ah, good point. I went with your second approach a
733 decoder_->ReturnFrontBuffer(mailbox, is_lost);
725 } 734 }
726 735
727 void GpuCommandBufferStub::OnParseError() { 736 void GpuCommandBufferStub::OnParseError() {
728 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnParseError"); 737 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnParseError");
729 DCHECK(command_buffer_.get()); 738 DCHECK(command_buffer_.get());
730 CommandBuffer::State state = command_buffer_->GetLastState(); 739 CommandBuffer::State state = command_buffer_->GetLastState();
731 IPC::Message* msg = new GpuCommandBufferMsg_Destroyed( 740 IPC::Message* msg = new GpuCommandBufferMsg_Destroyed(
732 route_id_, state.context_lost_reason, state.error); 741 route_id_, state.context_lost_reason, state.error);
733 msg->set_unblock(true); 742 msg->set_unblock(true);
734 Send(msg); 743 Send(msg);
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 result)); 1142 result));
1134 } 1143 }
1135 1144
1136 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, 1145 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase,
1137 base::TimeDelta interval) { 1146 base::TimeDelta interval) {
1138 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, 1147 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase,
1139 interval)); 1148 interval));
1140 } 1149 }
1141 1150
1142 } // namespace gpu 1151 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/service/gpu_command_buffer_stub.h ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698