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

Side by Side Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 215803002: Remove CommandBuffer::GetTransferBuffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 8 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 | Annotate | Revision Log
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/hash.h" 9 #include "base/hash.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetState, OnGetState); 196 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetState, OnGetState);
197 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetStateFast, 197 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetStateFast,
198 OnGetStateFast); 198 OnGetStateFast);
199 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush); 199 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush);
200 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetLatencyInfo, OnSetLatencyInfo); 200 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetLatencyInfo, OnSetLatencyInfo);
201 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled); 201 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled);
202 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RegisterTransferBuffer, 202 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RegisterTransferBuffer,
203 OnRegisterTransferBuffer); 203 OnRegisterTransferBuffer);
204 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer, 204 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer,
205 OnDestroyTransferBuffer); 205 OnDestroyTransferBuffer);
206 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetTransferBuffer,
207 OnGetTransferBuffer);
208 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoDecoder, 206 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoDecoder,
209 OnCreateVideoDecoder) 207 OnCreateVideoDecoder)
210 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetSurfaceVisible, 208 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetSurfaceVisible,
211 OnSetSurfaceVisible) 209 OnSetSurfaceVisible)
212 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RetireSyncPoint, 210 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RetireSyncPoint,
213 OnRetireSyncPoint) 211 OnRetireSyncPoint)
214 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPoint, 212 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPoint,
215 OnSignalSyncPoint) 213 OnSignalSyncPoint)
216 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalQuery, 214 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalQuery,
217 OnSignalQuery) 215 OnSignalQuery)
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 command_buffer_->RegisterTransferBuffer(id, shared_memory.Pass(), size); 698 command_buffer_->RegisterTransferBuffer(id, shared_memory.Pass(), size);
701 } 699 }
702 700
703 void GpuCommandBufferStub::OnDestroyTransferBuffer(int32 id) { 701 void GpuCommandBufferStub::OnDestroyTransferBuffer(int32 id) {
704 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyTransferBuffer"); 702 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyTransferBuffer");
705 703
706 if (command_buffer_) 704 if (command_buffer_)
707 command_buffer_->DestroyTransferBuffer(id); 705 command_buffer_->DestroyTransferBuffer(id);
708 } 706 }
709 707
710 void GpuCommandBufferStub::OnGetTransferBuffer(
711 int32 id,
712 IPC::Message* reply_message) {
713 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnGetTransferBuffer");
714 if (command_buffer_) {
715 base::SharedMemoryHandle transfer_buffer = base::SharedMemoryHandle();
716 uint32 size = 0;
717
718 scoped_refptr<gpu::Buffer> buffer = command_buffer_->GetTransferBuffer(id);
719 if (buffer && buffer->shared_memory()) {
720 #if defined(OS_WIN)
721 transfer_buffer = NULL;
722 BrokerDuplicateHandle(buffer->shared_memory()->handle(),
723 channel_->renderer_pid(),
724 &transfer_buffer,
725 FILE_MAP_READ | FILE_MAP_WRITE,
726 0);
727 DCHECK(transfer_buffer != NULL);
728 #else
729 buffer->shared_memory()->ShareToProcess(channel_->renderer_pid(),
730 &transfer_buffer);
731 #endif
732 size = buffer->size();
733 }
734
735 GpuCommandBufferMsg_GetTransferBuffer::WriteReplyParams(reply_message,
736 transfer_buffer,
737 size);
738 } else {
739 reply_message->set_reply_error();
740 }
741 Send(reply_message);
742 }
743
744 void GpuCommandBufferStub::OnCommandProcessed() { 708 void GpuCommandBufferStub::OnCommandProcessed() {
745 if (watchdog_) 709 if (watchdog_)
746 watchdog_->CheckArmed(); 710 watchdog_->CheckArmed();
747 } 711 }
748 712
749 void GpuCommandBufferStub::ReportState() { 713 void GpuCommandBufferStub::ReportState() {
750 if (!CheckContextLost()) 714 if (!CheckContextLost())
751 command_buffer_->UpdateState(); 715 command_buffer_->UpdateState();
752 } 716 }
753 717
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 if (decoder_) 959 if (decoder_)
996 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); 960 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB);
997 command_buffer_->SetParseError(gpu::error::kLostContext); 961 command_buffer_->SetParseError(gpu::error::kLostContext);
998 } 962 }
999 963
1000 uint64 GpuCommandBufferStub::GetMemoryUsage() const { 964 uint64 GpuCommandBufferStub::GetMemoryUsage() const {
1001 return GetMemoryManager()->GetClientMemoryUsage(this); 965 return GetMemoryManager()->GetClientMemoryUsage(this);
1002 } 966 }
1003 967
1004 } // namespace content 968 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/command_buffer_proxy_impl.cc ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698