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); | |
140 IPC_MESSAGE_HANDLER(ViewMsg_ReclaimCompositorResources, | 138 IPC_MESSAGE_HANDLER(ViewMsg_ReclaimCompositorResources, |
141 OnReclaimCompositorResources); | 139 OnReclaimCompositorResources); |
142 IPC_END_MESSAGE_MAP() | 140 IPC_END_MESSAGE_MAP() |
143 } | 141 } |
144 | 142 |
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 | |
156 void CompositorOutputSurface::OnReclaimCompositorResources( | 143 void CompositorOutputSurface::OnReclaimCompositorResources( |
157 uint32_t output_surface_id, | 144 uint32_t output_surface_id, |
158 bool is_swap_ack, | 145 bool is_swap_ack, |
159 const cc::ReturnedResourceArray& resources) { | 146 const cc::ReturnedResourceArray& resources) { |
160 // Ignore message if it's a stale one coming from a different output surface | 147 // Ignore message if it's a stale one coming from a different output surface |
161 // (e.g. after a lost context). | 148 // (e.g. after a lost context). |
162 if (output_surface_id != output_surface_id_) | 149 if (output_surface_id != output_surface_id_) |
163 return; | 150 return; |
164 ReclaimResources(resources); | 151 ReclaimResources(resources); |
165 if (is_swap_ack) | 152 if (is_swap_ack) |
166 client_->DidSwapBuffersComplete(); | 153 client_->DidSwapBuffersComplete(); |
167 } | 154 } |
168 | 155 |
169 bool CompositorOutputSurface::Send(IPC::Message* message) { | 156 bool CompositorOutputSurface::Send(IPC::Message* message) { |
170 return message_sender_->Send(message); | 157 return message_sender_->Send(message); |
171 } | 158 } |
172 | 159 |
173 } // namespace content | 160 } // namespace content |
OLD | NEW |