OLD | NEW |
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/renderer/gpu/compositor_output_surface.h" | 5 #include "content/renderer/gpu/compositor_output_surface.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 OnUpdateVSyncParametersFromBrowser); | 170 OnUpdateVSyncParametersFromBrowser); |
171 IPC_MESSAGE_HANDLER(ViewMsg_SwapCompositorFrameAck, OnSwapAck); | 171 IPC_MESSAGE_HANDLER(ViewMsg_SwapCompositorFrameAck, OnSwapAck); |
172 IPC_MESSAGE_HANDLER(ViewMsg_ReclaimCompositorResources, OnReclaimResources); | 172 IPC_MESSAGE_HANDLER(ViewMsg_ReclaimCompositorResources, OnReclaimResources); |
173 IPC_END_MESSAGE_MAP() | 173 IPC_END_MESSAGE_MAP() |
174 } | 174 } |
175 | 175 |
176 void CompositorOutputSurface::OnUpdateVSyncParametersFromBrowser( | 176 void CompositorOutputSurface::OnUpdateVSyncParametersFromBrowser( |
177 base::TimeTicks timebase, | 177 base::TimeTicks timebase, |
178 base::TimeDelta interval) { | 178 base::TimeDelta interval) { |
179 DCHECK(client_thread_checker_.CalledOnValidThread()); | 179 DCHECK(client_thread_checker_.CalledOnValidThread()); |
180 CommitVSyncParameters(timebase, interval); | 180 TRACE_EVENT2("cc", |
| 181 "CompositorOutputSurface::OnUpdateVSyncParametersFromBrowser", |
| 182 "timebase", (timebase - base::TimeTicks()).InSecondsF(), |
| 183 "interval", interval.InSecondsF()); |
| 184 client_->CommitVSyncParameters(timebase, interval); |
181 } | 185 } |
182 | 186 |
183 void CompositorOutputSurface::OnSwapAck(uint32_t output_surface_id, | 187 void CompositorOutputSurface::OnSwapAck(uint32_t output_surface_id, |
184 const cc::CompositorFrameAck& ack) { | 188 const cc::CompositorFrameAck& ack) { |
185 // Ignore message if it's a stale one coming from a different output surface | 189 // Ignore message if it's a stale one coming from a different output surface |
186 // (e.g. after a lost context). | 190 // (e.g. after a lost context). |
187 if (output_surface_id != output_surface_id_) | 191 if (output_surface_id != output_surface_id_) |
188 return; | 192 return; |
189 ReclaimResources(&ack); | 193 ReclaimResources(&ack); |
190 client_->DidSwapBuffersComplete(); | 194 client_->DidSwapBuffersComplete(); |
191 } | 195 } |
192 | 196 |
193 void CompositorOutputSurface::OnReclaimResources( | 197 void CompositorOutputSurface::OnReclaimResources( |
194 uint32_t output_surface_id, | 198 uint32_t output_surface_id, |
195 const cc::CompositorFrameAck& ack) { | 199 const cc::CompositorFrameAck& ack) { |
196 // Ignore message if it's a stale one coming from a different output surface | 200 // Ignore message if it's a stale one coming from a different output surface |
197 // (e.g. after a lost context). | 201 // (e.g. after a lost context). |
198 if (output_surface_id != output_surface_id_) | 202 if (output_surface_id != output_surface_id_) |
199 return; | 203 return; |
200 ReclaimResources(&ack); | 204 ReclaimResources(&ack); |
201 } | 205 } |
202 | 206 |
203 bool CompositorOutputSurface::Send(IPC::Message* message) { | 207 bool CompositorOutputSurface::Send(IPC::Message* message) { |
204 return message_sender_->Send(message); | 208 return message_sender_->Send(message); |
205 } | 209 } |
206 | 210 |
207 } // namespace content | 211 } // namespace content |
OLD | NEW |