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

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
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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 158
159 bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) { 159 bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) {
160 FastSetActiveURL(active_url_, active_url_hash_); 160 FastSetActiveURL(active_url_, active_url_hash_);
161 161
162 // Ensure the appropriate GL context is current before handling any IPC 162 // Ensure the appropriate GL context is current before handling any IPC
163 // messages directed at the command buffer. This ensures that the message 163 // messages directed at the command buffer. This ensures that the message
164 // handler can assume that the context is current (not necessary for 164 // handler can assume that the context is current (not necessary for
165 // Echo, RetireSyncPoint, or WaitSyncPoint). 165 // Echo, RetireSyncPoint, or WaitSyncPoint).
166 if (decoder_.get() && 166 if (decoder_.get() &&
167 message.type() != GpuCommandBufferMsg_Echo::ID && 167 message.type() != GpuCommandBufferMsg_Echo::ID &&
168 message.type() != GpuCommandBufferMsg_RetireSyncPoint::ID) { 168 message.type() != GpuCommandBufferMsg_RetireSyncPoint::ID &&
169 message.type() != GpuCommandBufferMsg_SetLatencyInfo::ID) {
169 if (!MakeCurrent()) 170 if (!MakeCurrent())
170 return false; 171 return false;
171 } 172 }
172 173
173 // Always use IPC_MESSAGE_HANDLER_DELAY_REPLY for synchronous message handlers 174 // Always use IPC_MESSAGE_HANDLER_DELAY_REPLY for synchronous message handlers
174 // here. This is so the reply can be delayed if the scheduler is unscheduled. 175 // here. This is so the reply can be delayed if the scheduler is unscheduled.
175 bool handled = true; 176 bool handled = true;
176 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message) 177 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message)
177 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Initialize, 178 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Initialize,
178 OnInitialize); 179 OnInitialize);
179 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetGetBuffer, 180 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetGetBuffer,
180 OnSetGetBuffer); 181 OnSetGetBuffer);
181 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetParent, 182 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetParent,
182 OnSetParent); 183 OnSetParent);
183 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Echo, OnEcho); 184 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Echo, OnEcho);
184 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetState, OnGetState); 185 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetState, OnGetState);
185 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetStateFast, 186 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetStateFast,
186 OnGetStateFast); 187 OnGetStateFast);
187 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush); 188 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush);
189 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetLatencyInfo, OnSetLatencyInfo);
188 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled); 190 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled);
189 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RegisterTransferBuffer, 191 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RegisterTransferBuffer,
190 OnRegisterTransferBuffer); 192 OnRegisterTransferBuffer);
191 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer, 193 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer,
192 OnDestroyTransferBuffer); 194 OnDestroyTransferBuffer);
193 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetTransferBuffer, 195 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetTransferBuffer,
194 OnGetTransferBuffer); 196 OnGetTransferBuffer);
195 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoDecoder, 197 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoDecoder,
196 OnCreateVideoDecoder) 198 OnCreateVideoDecoder)
197 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyVideoDecoder, 199 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyVideoDecoder,
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, true); 568 GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, true);
567 Send(reply_message); 569 Send(reply_message);
568 570
569 if (handle_.is_null() && !active_url_.is_empty()) { 571 if (handle_.is_null() && !active_url_.is_empty()) {
570 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); 572 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager();
571 gpu_channel_manager->Send(new GpuHostMsg_DidCreateOffscreenContext( 573 gpu_channel_manager->Send(new GpuHostMsg_DidCreateOffscreenContext(
572 active_url_)); 574 active_url_));
573 } 575 }
574 } 576 }
575 577
578 void GpuCommandBufferStub::OnSetLatencyInfo(
579 const cc::LatencyInfo& latency_info) {
580 if (!latency_info_callback_.is_null())
581 latency_info_callback_.Run(latency_info);
582 }
583
584 void GpuCommandBufferStub::SetLatencyInfoCallback(
585 const LatencyInfoCallback& callback) {
586 latency_info_callback_ = callback;
587 }
588
576 void GpuCommandBufferStub::OnSetGetBuffer(int32 shm_id, 589 void GpuCommandBufferStub::OnSetGetBuffer(int32 shm_id,
577 IPC::Message* reply_message) { 590 IPC::Message* reply_message) {
578 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetGetBuffer"); 591 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetGetBuffer");
579 if (command_buffer_.get()) 592 if (command_buffer_.get())
580 command_buffer_->SetGetBuffer(shm_id); 593 command_buffer_->SetGetBuffer(shm_id);
581 Send(reply_message); 594 Send(reply_message);
582 } 595 }
583 596
584 void GpuCommandBufferStub::OnSetParent(int32 parent_route_id, 597 void GpuCommandBufferStub::OnSetParent(int32 parent_route_id,
585 uint32 parent_texture_id, 598 uint32 parent_texture_id,
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 if (surface_ && MakeCurrent()) 947 if (surface_ && MakeCurrent())
935 surface_->SetFrontbufferAllocation( 948 surface_->SetFrontbufferAllocation(
936 allocation.browser_allocation.suggest_have_frontbuffer); 949 allocation.browser_allocation.suggest_have_frontbuffer);
937 } 950 }
938 951
939 last_memory_allocation_valid_ = true; 952 last_memory_allocation_valid_ = true;
940 last_memory_allocation_ = allocation; 953 last_memory_allocation_ = allocation;
941 } 954 }
942 955
943 } // namespace content 956 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698