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

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: minor input event changes Created 8 years 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 IPC_BEGIN_MESSAGE_MAP(CommandBufferProxyImpl, message) 63 IPC_BEGIN_MESSAGE_MAP(CommandBufferProxyImpl, message)
64 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Destroyed, OnDestroyed); 64 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Destroyed, OnDestroyed);
65 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_NotifyRepaint, 65 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_NotifyRepaint,
66 OnNotifyRepaint); 66 OnNotifyRepaint);
67 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_EchoAck, OnEchoAck); 67 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_EchoAck, OnEchoAck);
68 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ConsoleMsg, OnConsoleMessage); 68 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ConsoleMsg, OnConsoleMessage);
69 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetMemoryAllocation, 69 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetMemoryAllocation,
70 OnSetMemoryAllocation); 70 OnSetMemoryAllocation);
71 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPointAck, 71 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPointAck,
72 OnSignalSyncPointAck); 72 OnSignalSyncPointAck);
73 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetLatencyInfo,
74 OnSetLatencyInfo);
73 IPC_MESSAGE_UNHANDLED(handled = false) 75 IPC_MESSAGE_UNHANDLED(handled = false)
74 IPC_END_MESSAGE_MAP() 76 IPC_END_MESSAGE_MAP()
75 77
76 DCHECK(handled); 78 DCHECK(handled);
77 return handled; 79 return handled;
78 } 80 }
79 81
80 void CommandBufferProxyImpl::OnChannelError() { 82 void CommandBufferProxyImpl::OnChannelError() {
81 OnDestroyed(gpu::error::kUnknown); 83 OnDestroyed(gpu::error::kUnknown);
82 } 84 }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 if (last_put_offset_ == put_offset) 208 if (last_put_offset_ == put_offset)
207 return; 209 return;
208 210
209 last_put_offset_ = put_offset; 211 last_put_offset_ = put_offset;
210 212
211 Send(new GpuCommandBufferMsg_AsyncFlush(route_id_, 213 Send(new GpuCommandBufferMsg_AsyncFlush(route_id_,
212 put_offset, 214 put_offset,
213 ++flush_count_)); 215 ++flush_count_));
214 } 216 }
215 217
218 void CommandBufferProxyImpl::SetLatencyInfo(
219 const WebKit::WebLatencyInfoImpl& latency_info) {
220 Send(new GpuCommandBufferMsg_SetLatencyInfo(route_id_, latency_info));
221 }
222
223 void CommandBufferProxyImpl::SetLatencyInfoCallback(
224 const GpuLatencyInfoCallback& callback) {
225 latency_info_callback_ = callback;
226 }
227
228 void CommandBufferProxyImpl::OnSetLatencyInfo(
229 const WebKit::WebLatencyInfoImpl& latency_info) {
230 if (!latency_info_callback_.is_null())
231 latency_info_callback_.Run(latency_info);
232 }
233
216 gpu::CommandBuffer::State CommandBufferProxyImpl::FlushSync( 234 gpu::CommandBuffer::State CommandBufferProxyImpl::FlushSync(
217 int32 put_offset, 235 int32 put_offset,
218 int32 last_known_get) { 236 int32 last_known_get) {
219 TRACE_EVENT1("gpu", "CommandBufferProxyImpl::FlushSync", "put_offset", 237 TRACE_EVENT1("gpu", "CommandBufferProxyImpl::FlushSync", "put_offset",
220 put_offset); 238 put_offset);
221 Flush(put_offset); 239 Flush(put_offset);
222 TryUpdateState(); 240 TryUpdateState();
223 if (last_known_get == last_state_.get_offset) { 241 if (last_known_get == last_state_.get_offset) {
224 // Send will flag state with lost context if IPC fails. 242 // Send will flag state with lost context if IPC fails.
225 if (last_state_.error == gpu::error::kNoError) { 243 if (last_state_.error == gpu::error::kNoError) {
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 void CommandBufferProxyImpl::SendManagedMemoryStats( 592 void CommandBufferProxyImpl::SendManagedMemoryStats(
575 const GpuManagedMemoryStats& stats) { 593 const GpuManagedMemoryStats& stats) {
576 if (last_state_.error != gpu::error::kNoError) 594 if (last_state_.error != gpu::error::kNoError)
577 return; 595 return;
578 596
579 Send(new GpuCommandBufferMsg_SendClientManagedMemoryStats(route_id_, 597 Send(new GpuCommandBufferMsg_SendClientManagedMemoryStats(route_id_,
580 stats)); 598 stats));
581 } 599 }
582 600
583 } // namespace content 601 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698