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

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

Issue 11195011: Send vsync timebase updates to the browser compositor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Send vsync timebase updates to the browser compositor Created 8 years, 2 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 IPC_BEGIN_MESSAGE_MAP(CommandBufferProxyImpl, message) 61 IPC_BEGIN_MESSAGE_MAP(CommandBufferProxyImpl, message)
62 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Destroyed, OnDestroyed); 62 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Destroyed, OnDestroyed);
63 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_NotifyRepaint, 63 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_NotifyRepaint,
64 OnNotifyRepaint); 64 OnNotifyRepaint);
65 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_EchoAck, OnEchoAck); 65 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_EchoAck, OnEchoAck);
66 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ConsoleMsg, OnConsoleMessage); 66 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ConsoleMsg, OnConsoleMessage);
67 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetMemoryAllocation, 67 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetMemoryAllocation,
68 OnSetMemoryAllocation); 68 OnSetMemoryAllocation);
69 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPointAck, 69 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPointAck,
70 OnSignalSyncPointAck); 70 OnSignalSyncPointAck);
71 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_UpdateVSyncTime, OnUpdateVSyncTime);
71 IPC_MESSAGE_UNHANDLED(handled = false) 72 IPC_MESSAGE_UNHANDLED(handled = false)
72 IPC_END_MESSAGE_MAP() 73 IPC_END_MESSAGE_MAP()
73 74
74 DCHECK(handled); 75 DCHECK(handled);
75 return handled; 76 return handled;
76 } 77 }
77 78
78 void CommandBufferProxyImpl::OnChannelError() { 79 void CommandBufferProxyImpl::OnChannelError() {
79 OnDestroyed(gpu::error::kUnknown); 80 OnDestroyed(gpu::error::kUnknown);
80 } 81 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 128 }
128 129
129 void CommandBufferProxyImpl::OnSignalSyncPointAck(uint32 id) { 130 void CommandBufferProxyImpl::OnSignalSyncPointAck(uint32 id) {
130 SignalTaskMap::iterator it = signal_tasks_.find(id); 131 SignalTaskMap::iterator it = signal_tasks_.find(id);
131 DCHECK(it != signal_tasks_.end()); 132 DCHECK(it != signal_tasks_.end());
132 base::Closure callback = it->second; 133 base::Closure callback = it->second;
133 signal_tasks_.erase(it); 134 signal_tasks_.erase(it);
134 callback.Run(); 135 callback.Run();
135 } 136 }
136 137
138 void CommandBufferProxyImpl::SetUpdateVSyncTimeCallback(
139 const base::Callback<void(int64)>& callback) {
140 update_vsync_time_callback_ = callback;
141 }
142
143 void CommandBufferProxyImpl::OnUpdateVSyncTime(int64 time) {
144 if (!update_vsync_time_callback_.is_null())
145 update_vsync_time_callback_.Run(time);
146 }
147
137 void CommandBufferProxyImpl::SetChannelErrorCallback( 148 void CommandBufferProxyImpl::SetChannelErrorCallback(
138 const base::Closure& callback) { 149 const base::Closure& callback) {
139 channel_error_callback_ = callback; 150 channel_error_callback_ = callback;
140 } 151 }
141 152
142 bool CommandBufferProxyImpl::Initialize() { 153 bool CommandBufferProxyImpl::Initialize() {
143 bool result; 154 bool result;
144 if (!Send(new GpuCommandBufferMsg_Initialize(route_id_, &result))) { 155 if (!Send(new GpuCommandBufferMsg_Initialize(route_id_, &result))) {
145 LOG(ERROR) << "Could not send GpuCommandBufferMsg_Initialize."; 156 LOG(ERROR) << "Could not send GpuCommandBufferMsg_Initialize.";
146 return false; 157 return false;
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 565
555 void CommandBufferProxyImpl::SetOnConsoleMessageCallback( 566 void CommandBufferProxyImpl::SetOnConsoleMessageCallback(
556 const GpuConsoleMessageCallback& callback) { 567 const GpuConsoleMessageCallback& callback) {
557 console_message_callback_ = callback; 568 console_message_callback_ = callback;
558 } 569 }
559 570
560 void CommandBufferProxyImpl::TryUpdateState() { 571 void CommandBufferProxyImpl::TryUpdateState() {
561 if (last_state_.error == gpu::error::kNoError) 572 if (last_state_.error == gpu::error::kNoError)
562 shared_state_->Read(&last_state_); 573 shared_state_->Read(&last_state_);
563 } 574 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698