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

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, 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
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.h ('k') | content/common/gpu/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 "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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) { 162 bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) {
163 FastSetActiveURL(active_url_, active_url_hash_); 163 FastSetActiveURL(active_url_, active_url_hash_);
164 164
165 // Ensure the appropriate GL context is current before handling any IPC 165 // Ensure the appropriate GL context is current before handling any IPC
166 // messages directed at the command buffer. This ensures that the message 166 // messages directed at the command buffer. This ensures that the message
167 // handler can assume that the context is current (not necessary for 167 // handler can assume that the context is current (not necessary for
168 // Echo, RetireSyncPoint, or WaitSyncPoint). 168 // Echo, RetireSyncPoint, or WaitSyncPoint).
169 if (decoder_.get() && 169 if (decoder_.get() &&
170 message.type() != GpuCommandBufferMsg_Echo::ID && 170 message.type() != GpuCommandBufferMsg_Echo::ID &&
171 message.type() != GpuCommandBufferMsg_RetireSyncPoint::ID) { 171 message.type() != GpuCommandBufferMsg_RetireSyncPoint::ID &&
172 message.type() != GpuCommandBufferMsg_SetLatencyInfo::ID) {
172 if (!MakeCurrent()) 173 if (!MakeCurrent())
173 return false; 174 return false;
174 } 175 }
175 176
176 // Always use IPC_MESSAGE_HANDLER_DELAY_REPLY for synchronous message handlers 177 // Always use IPC_MESSAGE_HANDLER_DELAY_REPLY for synchronous message handlers
177 // here. This is so the reply can be delayed if the scheduler is unscheduled. 178 // here. This is so the reply can be delayed if the scheduler is unscheduled.
178 bool handled = true; 179 bool handled = true;
179 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message) 180 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message)
180 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Initialize, 181 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Initialize,
181 OnInitialize); 182 OnInitialize);
182 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetGetBuffer, 183 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetGetBuffer,
183 OnSetGetBuffer); 184 OnSetGetBuffer);
184 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetParent, 185 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetParent,
185 OnSetParent); 186 OnSetParent);
186 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Echo, OnEcho); 187 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Echo, OnEcho);
187 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetState, OnGetState); 188 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetState, OnGetState);
188 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetStateFast, 189 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetStateFast,
189 OnGetStateFast); 190 OnGetStateFast);
190 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush); 191 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush);
192 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetLatencyInfo, OnSetLatencyInfo);
191 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled); 193 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled);
192 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RegisterTransferBuffer, 194 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RegisterTransferBuffer,
193 OnRegisterTransferBuffer); 195 OnRegisterTransferBuffer);
194 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer, 196 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer,
195 OnDestroyTransferBuffer); 197 OnDestroyTransferBuffer);
196 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetTransferBuffer, 198 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetTransferBuffer,
197 OnGetTransferBuffer); 199 OnGetTransferBuffer);
198 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoDecoder, 200 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoDecoder,
199 OnCreateVideoDecoder) 201 OnCreateVideoDecoder)
200 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetSurfaceVisible, 202 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetSurfaceVisible,
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, true); 559 GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, true);
558 Send(reply_message); 560 Send(reply_message);
559 561
560 if (handle_.is_null() && !active_url_.is_empty()) { 562 if (handle_.is_null() && !active_url_.is_empty()) {
561 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); 563 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager();
562 gpu_channel_manager->Send(new GpuHostMsg_DidCreateOffscreenContext( 564 gpu_channel_manager->Send(new GpuHostMsg_DidCreateOffscreenContext(
563 active_url_)); 565 active_url_));
564 } 566 }
565 } 567 }
566 568
569 void GpuCommandBufferStub::OnSetLatencyInfo(
570 const cc::LatencyInfo& latency_info) {
571 if (!latency_info_callback_.is_null())
572 latency_info_callback_.Run(latency_info);
573 }
574
575 void GpuCommandBufferStub::SetLatencyInfoCallback(
576 const LatencyInfoCallback& callback) {
577 latency_info_callback_ = callback;
578 }
579
567 void GpuCommandBufferStub::OnSetGetBuffer(int32 shm_id, 580 void GpuCommandBufferStub::OnSetGetBuffer(int32 shm_id,
568 IPC::Message* reply_message) { 581 IPC::Message* reply_message) {
569 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetGetBuffer"); 582 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetGetBuffer");
570 if (command_buffer_.get()) 583 if (command_buffer_.get())
571 command_buffer_->SetGetBuffer(shm_id); 584 command_buffer_->SetGetBuffer(shm_id);
572 Send(reply_message); 585 Send(reply_message);
573 } 586 }
574 587
575 void GpuCommandBufferStub::OnSetParent(int32 parent_route_id, 588 void GpuCommandBufferStub::OnSetParent(int32 parent_route_id,
576 uint32 parent_texture_id, 589 uint32 parent_texture_id,
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 if (surface_ && MakeCurrent()) 933 if (surface_ && MakeCurrent())
921 surface_->SetFrontbufferAllocation( 934 surface_->SetFrontbufferAllocation(
922 allocation.browser_allocation.suggest_have_frontbuffer); 935 allocation.browser_allocation.suggest_have_frontbuffer);
923 } 936 }
924 937
925 last_memory_allocation_valid_ = true; 938 last_memory_allocation_valid_ = true;
926 last_memory_allocation_ = allocation; 939 last_memory_allocation_ = allocation;
927 } 940 }
928 941
929 } // namespace content 942 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.h ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698