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

Side by Side Diff: content/common/gpu/client/command_buffer_proxy_impl.cc

Issue 11293121: Add latency measurement system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: create cc::LatencyInfo Created 7 years, 11 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 "content/common/gpu/client/command_buffer_proxy_impl.h" 5 #include "content/common/gpu/client/command_buffer_proxy_impl.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 bool CommandBufferProxyImpl::OnMessageReceived(const IPC::Message& message) { 51 bool CommandBufferProxyImpl::OnMessageReceived(const IPC::Message& message) {
52 bool handled = true; 52 bool handled = true;
53 IPC_BEGIN_MESSAGE_MAP(CommandBufferProxyImpl, message) 53 IPC_BEGIN_MESSAGE_MAP(CommandBufferProxyImpl, message)
54 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Destroyed, OnDestroyed); 54 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Destroyed, OnDestroyed);
55 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_EchoAck, OnEchoAck); 55 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_EchoAck, OnEchoAck);
56 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ConsoleMsg, OnConsoleMessage); 56 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ConsoleMsg, OnConsoleMessage);
57 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetMemoryAllocation, 57 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetMemoryAllocation,
58 OnSetMemoryAllocation); 58 OnSetMemoryAllocation);
59 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPointAck, 59 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPointAck,
60 OnSignalSyncPointAck); 60 OnSignalSyncPointAck);
61 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetLatencyInfo,
62 OnSetLatencyInfo);
61 IPC_MESSAGE_UNHANDLED(handled = false) 63 IPC_MESSAGE_UNHANDLED(handled = false)
62 IPC_END_MESSAGE_MAP() 64 IPC_END_MESSAGE_MAP()
63 65
64 DCHECK(handled); 66 DCHECK(handled);
65 return handled; 67 return handled;
66 } 68 }
67 69
68 void CommandBufferProxyImpl::OnChannelError() { 70 void CommandBufferProxyImpl::OnChannelError() {
69 OnDestroyed(gpu::error::kUnknown); 71 OnDestroyed(gpu::error::kUnknown);
70 } 72 }
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 if (last_put_offset_ == put_offset) 192 if (last_put_offset_ == put_offset)
191 return; 193 return;
192 194
193 last_put_offset_ = put_offset; 195 last_put_offset_ = put_offset;
194 196
195 Send(new GpuCommandBufferMsg_AsyncFlush(route_id_, 197 Send(new GpuCommandBufferMsg_AsyncFlush(route_id_,
196 put_offset, 198 put_offset,
197 ++flush_count_)); 199 ++flush_count_));
198 } 200 }
199 201
202 void CommandBufferProxyImpl::SetLatencyInfo(
203 const cc::LatencyInfo& latency_info) {
204 Send(new GpuCommandBufferMsg_SetLatencyInfo(route_id_, latency_info));
205 }
206
207 void CommandBufferProxyImpl::SetLatencyInfoCallback(
208 const GpuLatencyInfoCallback& callback) {
209 latency_info_callback_ = callback;
210 }
211
212 void CommandBufferProxyImpl::OnSetLatencyInfo(
213 const cc::LatencyInfo& latency_info) {
214 if (!latency_info_callback_.is_null())
215 latency_info_callback_.Run(latency_info);
216 }
217
200 gpu::CommandBuffer::State CommandBufferProxyImpl::FlushSync( 218 gpu::CommandBuffer::State CommandBufferProxyImpl::FlushSync(
201 int32 put_offset, 219 int32 put_offset,
202 int32 last_known_get) { 220 int32 last_known_get) {
203 TRACE_EVENT1("gpu", "CommandBufferProxyImpl::FlushSync", "put_offset", 221 TRACE_EVENT1("gpu", "CommandBufferProxyImpl::FlushSync", "put_offset",
204 put_offset); 222 put_offset);
205 Flush(put_offset); 223 Flush(put_offset);
206 TryUpdateState(); 224 TryUpdateState();
207 if (last_known_get == last_state_.get_offset) { 225 if (last_known_get == last_state_.get_offset) {
208 // Send will flag state with lost context if IPC fails. 226 // Send will flag state with lost context if IPC fails.
209 if (last_state_.error == gpu::error::kNoError) { 227 if (last_state_.error == gpu::error::kNoError) {
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 void CommandBufferProxyImpl::SendManagedMemoryStats( 542 void CommandBufferProxyImpl::SendManagedMemoryStats(
525 const GpuManagedMemoryStats& stats) { 543 const GpuManagedMemoryStats& stats) {
526 if (last_state_.error != gpu::error::kNoError) 544 if (last_state_.error != gpu::error::kNoError)
527 return; 545 return;
528 546
529 Send(new GpuCommandBufferMsg_SendClientManagedMemoryStats(route_id_, 547 Send(new GpuCommandBufferMsg_SendClientManagedMemoryStats(route_id_,
530 stats)); 548 stats));
531 } 549 }
532 550
533 } // namespace content 551 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/command_buffer_proxy_impl.h ('k') | content/common/gpu/gpu_command_buffer_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698