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