Chromium Code Reviews| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 } | 133 } |
| 134 | 134 |
| 135 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { | 135 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { |
| 136 DCHECK(client_thread_checker_.CalledOnValidThread()); | 136 DCHECK(client_thread_checker_.CalledOnValidThread()); |
| 137 if (!HasClient()) | 137 if (!HasClient()) |
| 138 return; | 138 return; |
| 139 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message) | 139 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message) |
| 140 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, | 140 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, |
| 141 OnUpdateVSyncParametersFromBrowser); | 141 OnUpdateVSyncParametersFromBrowser); |
| 142 IPC_MESSAGE_HANDLER(ViewMsg_SwapCompositorFrameAck, OnSwapAck); | 142 IPC_MESSAGE_HANDLER(ViewMsg_SwapCompositorFrameAck, OnSwapAck); |
| 143 IPC_MESSAGE_HANDLER(ViewMsg_ReclaimCompositorResources, OnReclaimResources); | |
| 144 IPC_END_MESSAGE_MAP() | 143 IPC_END_MESSAGE_MAP() |
| 145 } | 144 } |
| 146 | 145 |
| 147 void CompositorOutputSurface::OnUpdateVSyncParametersFromBrowser( | 146 void CompositorOutputSurface::OnUpdateVSyncParametersFromBrowser( |
| 148 base::TimeTicks timebase, | 147 base::TimeTicks timebase, |
| 149 base::TimeDelta interval) { | 148 base::TimeDelta interval) { |
| 150 DCHECK(client_thread_checker_.CalledOnValidThread()); | 149 DCHECK(client_thread_checker_.CalledOnValidThread()); |
| 151 TRACE_EVENT2("cc", | 150 TRACE_EVENT2("cc", |
| 152 "CompositorOutputSurface::OnUpdateVSyncParametersFromBrowser", | 151 "CompositorOutputSurface::OnUpdateVSyncParametersFromBrowser", |
| 153 "timebase", (timebase - base::TimeTicks()).InSecondsF(), | 152 "timebase", (timebase - base::TimeTicks()).InSecondsF(), |
| 154 "interval", interval.InSecondsF()); | 153 "interval", interval.InSecondsF()); |
| 155 client_->CommitVSyncParameters(timebase, interval); | 154 client_->CommitVSyncParameters(timebase, interval); |
| 156 } | 155 } |
| 157 | 156 |
| 158 void CompositorOutputSurface::OnSwapAck(uint32_t output_surface_id, | 157 void CompositorOutputSurface::OnSwapAck(uint32_t output_surface_id, |
| 159 const cc::CompositorFrameAck& ack) { | 158 const cc::CompositorFrameAck& ack) { |
| 160 // Ignore message if it's a stale one coming from a different output surface | 159 // Ignore message if it's a stale one coming from a different output surface |
| 161 // (e.g. after a lost context). | 160 // (e.g. after a lost context). |
| 162 if (output_surface_id != output_surface_id_) | 161 if (output_surface_id != output_surface_id_) |
| 163 return; | 162 return; |
| 164 ReclaimResources(&ack); | 163 ReclaimResources(&ack); |
| 165 client_->DidSwapBuffersComplete(); | 164 client_->DidSwapBuffersComplete(); |
|
dcheng
2016/07/13 14:26:58
Does it matter that OnReclaimResources didn't call
Fady Samuel
2016/07/13 15:29:48
piman@ can better answer this question. I could ad
danakj
2016/07/13 18:40:20
This is what unthrottles the compositor to produce
| |
| 166 } | 165 } |
| 167 | 166 |
| 168 void CompositorOutputSurface::OnReclaimResources( | |
| 169 uint32_t output_surface_id, | |
| 170 const cc::CompositorFrameAck& ack) { | |
| 171 // Ignore message if it's a stale one coming from a different output surface | |
| 172 // (e.g. after a lost context). | |
| 173 if (output_surface_id != output_surface_id_) | |
| 174 return; | |
| 175 ReclaimResources(&ack); | |
| 176 } | |
| 177 | |
| 178 bool CompositorOutputSurface::Send(IPC::Message* message) { | 167 bool CompositorOutputSurface::Send(IPC::Message* message) { |
| 179 return message_sender_->Send(message); | 168 return message_sender_->Send(message); |
| 180 } | 169 } |
| 181 | 170 |
| 182 } // namespace content | 171 } // namespace content |
| OLD | NEW |