| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // This is a delegating output surface, no framebuffer/direct drawing support. | 128 // This is a delegating output surface, no framebuffer/direct drawing support. |
| 129 NOTREACHED(); | 129 NOTREACHED(); |
| 130 return 0; | 130 return 0; |
| 131 } | 131 } |
| 132 | 132 |
| 133 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { | 133 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { |
| 134 DCHECK(client_thread_checker_.CalledOnValidThread()); | 134 DCHECK(client_thread_checker_.CalledOnValidThread()); |
| 135 if (!HasClient()) | 135 if (!HasClient()) |
| 136 return; | 136 return; |
| 137 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message) | 137 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message) |
| 138 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, |
| 139 OnUpdateVSyncParametersFromBrowser); |
| 138 IPC_MESSAGE_HANDLER(ViewMsg_ReclaimCompositorResources, | 140 IPC_MESSAGE_HANDLER(ViewMsg_ReclaimCompositorResources, |
| 139 OnReclaimCompositorResources); | 141 OnReclaimCompositorResources); |
| 140 IPC_END_MESSAGE_MAP() | 142 IPC_END_MESSAGE_MAP() |
| 141 } | 143 } |
| 142 | 144 |
| 145 void CompositorOutputSurface::OnUpdateVSyncParametersFromBrowser( |
| 146 base::TimeTicks timebase, |
| 147 base::TimeDelta interval) { |
| 148 DCHECK(client_thread_checker_.CalledOnValidThread()); |
| 149 TRACE_EVENT2("cc", |
| 150 "CompositorOutputSurface::OnUpdateVSyncParametersFromBrowser", |
| 151 "timebase", (timebase - base::TimeTicks()).InSecondsF(), |
| 152 "interval", interval.InSecondsF()); |
| 153 client_->CommitVSyncParameters(timebase, interval); |
| 154 } |
| 155 |
| 143 void CompositorOutputSurface::OnReclaimCompositorResources( | 156 void CompositorOutputSurface::OnReclaimCompositorResources( |
| 144 uint32_t output_surface_id, | 157 uint32_t output_surface_id, |
| 145 bool is_swap_ack, | 158 bool is_swap_ack, |
| 146 const cc::ReturnedResourceArray& resources) { | 159 const cc::ReturnedResourceArray& resources) { |
| 147 // Ignore message if it's a stale one coming from a different output surface | 160 // Ignore message if it's a stale one coming from a different output surface |
| 148 // (e.g. after a lost context). | 161 // (e.g. after a lost context). |
| 149 if (output_surface_id != output_surface_id_) | 162 if (output_surface_id != output_surface_id_) |
| 150 return; | 163 return; |
| 151 ReclaimResources(resources); | 164 ReclaimResources(resources); |
| 152 if (is_swap_ack) | 165 if (is_swap_ack) |
| 153 client_->DidSwapBuffersComplete(); | 166 client_->DidSwapBuffersComplete(); |
| 154 } | 167 } |
| 155 | 168 |
| 156 bool CompositorOutputSurface::Send(IPC::Message* message) { | 169 bool CompositorOutputSurface::Send(IPC::Message* message) { |
| 157 return message_sender_->Send(message); | 170 return message_sender_->Send(message); |
| 158 } | 171 } |
| 159 | 172 |
| 160 } // namespace content | 173 } // namespace content |
| OLD | NEW |