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

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

Issue 12614013: Plumb cc::LatencyInfo through command buffer and output surface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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/shared_memory.h" 10 #include "base/shared_memory.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 154
155 bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) { 155 bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) {
156 FastSetActiveURL(active_url_, active_url_hash_); 156 FastSetActiveURL(active_url_, active_url_hash_);
157 157
158 // Ensure the appropriate GL context is current before handling any IPC 158 // Ensure the appropriate GL context is current before handling any IPC
159 // messages directed at the command buffer. This ensures that the message 159 // messages directed at the command buffer. This ensures that the message
160 // handler can assume that the context is current (not necessary for 160 // handler can assume that the context is current (not necessary for
161 // Echo, RetireSyncPoint, or WaitSyncPoint). 161 // Echo, RetireSyncPoint, or WaitSyncPoint).
162 if (decoder_.get() && 162 if (decoder_.get() &&
163 message.type() != GpuCommandBufferMsg_Echo::ID && 163 message.type() != GpuCommandBufferMsg_Echo::ID &&
164 message.type() != GpuCommandBufferMsg_RetireSyncPoint::ID) { 164 message.type() != GpuCommandBufferMsg_RetireSyncPoint::ID &&
165 message.type() != GpuCommandBufferMsg_SetLatencyInfo::ID) {
165 if (!MakeCurrent()) 166 if (!MakeCurrent())
166 return false; 167 return false;
167 } 168 }
168 169
169 // Always use IPC_MESSAGE_HANDLER_DELAY_REPLY for synchronous message handlers 170 // Always use IPC_MESSAGE_HANDLER_DELAY_REPLY for synchronous message handlers
170 // here. This is so the reply can be delayed if the scheduler is unscheduled. 171 // here. This is so the reply can be delayed if the scheduler is unscheduled.
171 bool handled = true; 172 bool handled = true;
172 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message) 173 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message)
173 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Initialize, 174 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Initialize,
174 OnInitialize); 175 OnInitialize);
175 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetGetBuffer, 176 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetGetBuffer,
176 OnSetGetBuffer); 177 OnSetGetBuffer);
177 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetParent, 178 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetParent,
178 OnSetParent); 179 OnSetParent);
179 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Echo, OnEcho); 180 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Echo, OnEcho);
180 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetState, OnGetState); 181 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetState, OnGetState);
181 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetStateFast, 182 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetStateFast,
182 OnGetStateFast); 183 OnGetStateFast);
183 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush); 184 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush);
185 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetLatencyInfo, OnSetLatencyInfo);
184 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled); 186 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled);
185 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RegisterTransferBuffer, 187 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RegisterTransferBuffer,
186 OnRegisterTransferBuffer); 188 OnRegisterTransferBuffer);
187 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer, 189 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer,
188 OnDestroyTransferBuffer); 190 OnDestroyTransferBuffer);
189 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetTransferBuffer, 191 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetTransferBuffer,
190 OnGetTransferBuffer); 192 OnGetTransferBuffer);
191 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoDecoder, 193 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoDecoder,
192 OnCreateVideoDecoder) 194 OnCreateVideoDecoder)
193 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyVideoDecoder, 195 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyVideoDecoder,
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, true); 513 GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, true);
512 Send(reply_message); 514 Send(reply_message);
513 515
514 if (handle_.is_null() && !active_url_.is_empty()) { 516 if (handle_.is_null() && !active_url_.is_empty()) {
515 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); 517 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager();
516 gpu_channel_manager->Send(new GpuHostMsg_DidCreateOffscreenContext( 518 gpu_channel_manager->Send(new GpuHostMsg_DidCreateOffscreenContext(
517 active_url_)); 519 active_url_));
518 } 520 }
519 } 521 }
520 522
523 void GpuCommandBufferStub::OnSetLatencyInfo(
524 const cc::LatencyInfo& latency_info) {
525 if (!latency_info_callback_.is_null())
526 latency_info_callback_.Run(latency_info);
527 }
528
529 void GpuCommandBufferStub::SetLatencyInfoCallback(
530 const LatencyInfoCallback& callback) {
531 latency_info_callback_ = callback;
532 }
533
534 void GpuCommandBufferStub::SetLatencyInfo(
535 const cc::LatencyInfo& latency_info) {
536 Send(new GpuCommandBufferMsg_SetLatencyInfo(route_id_, latency_info));
537 }
piman 2013/03/19 04:30:29 note: it's rather uncommon to have the same messag
538
521 void GpuCommandBufferStub::OnSetGetBuffer(int32 shm_id, 539 void GpuCommandBufferStub::OnSetGetBuffer(int32 shm_id,
522 IPC::Message* reply_message) { 540 IPC::Message* reply_message) {
523 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetGetBuffer"); 541 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetGetBuffer");
524 if (command_buffer_.get()) 542 if (command_buffer_.get())
525 command_buffer_->SetGetBuffer(shm_id); 543 command_buffer_->SetGetBuffer(shm_id);
526 Send(reply_message); 544 Send(reply_message);
527 } 545 }
528 546
529 void GpuCommandBufferStub::OnSetParent(int32 parent_route_id, 547 void GpuCommandBufferStub::OnSetParent(int32 parent_route_id,
530 uint32 parent_texture_id, 548 uint32 parent_texture_id,
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 if (surface_ && MakeCurrent()) 899 if (surface_ && MakeCurrent())
882 surface_->SetFrontbufferAllocation( 900 surface_->SetFrontbufferAllocation(
883 allocation.browser_allocation.suggest_have_frontbuffer); 901 allocation.browser_allocation.suggest_have_frontbuffer);
884 } 902 }
885 903
886 last_memory_allocation_valid_ = true; 904 last_memory_allocation_valid_ = true;
887 last_memory_allocation_ = allocation; 905 last_memory_allocation_ = allocation;
888 } 906 }
889 907
890 } // namespace content 908 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698