OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/thread_proxy.h" | 5 #include "cc/thread_proxy.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "cc/delay_based_time_source.h" | 10 #include "cc/delay_based_time_source.h" |
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 m_layerTreeHostImpl->setTreePriority(priority); | 1184 m_layerTreeHostImpl->setTreePriority(priority); |
1185 | 1185 |
1186 // Notify the the client of this compositor via the output surface. | 1186 // Notify the the client of this compositor via the output surface. |
1187 // TODO(epenner): Route this to compositor-thread instead of output-surface | 1187 // TODO(epenner): Route this to compositor-thread instead of output-surface |
1188 // after GTFO refactor of compositor-thread (http://crbug/170828). | 1188 // after GTFO refactor of compositor-thread (http://crbug/170828). |
1189 if (m_layerTreeHostImpl->outputSurface()) { | 1189 if (m_layerTreeHostImpl->outputSurface()) { |
1190 m_layerTreeHostImpl->outputSurface()->UpdateSmoothnessTakesPriority( | 1190 m_layerTreeHostImpl->outputSurface()->UpdateSmoothnessTakesPriority( |
1191 priority == SMOOTHNESS_TAKES_PRIORITY); | 1191 priority == SMOOTHNESS_TAKES_PRIORITY); |
1192 } | 1192 } |
1193 | 1193 |
| 1194 base::TimeDelta delay = m_smoothnessTakesPriorityExpirationTime - |
| 1195 base::TimeTicks::Now(); |
| 1196 |
1194 // Need to make sure a delayed task is posted when we have smoothness | 1197 // Need to make sure a delayed task is posted when we have smoothness |
1195 // takes priority expiration time in the future. | 1198 // takes priority expiration time in the future. |
1196 if (m_smoothnessTakesPriorityExpirationTime <= base::TimeTicks::Now()) | 1199 if (delay <= base::TimeDelta()) |
1197 return; | 1200 return; |
1198 if (m_renewTreePriorityOnImplThreadPending) | 1201 if (m_renewTreePriorityOnImplThreadPending) |
1199 return; | 1202 return; |
1200 | 1203 |
1201 base::TimeDelta delay = m_smoothnessTakesPriorityExpirationTime - | |
1202 base::TimeTicks::Now(); | |
1203 | |
1204 Proxy::implThread()->postDelayedTask( | 1204 Proxy::implThread()->postDelayedTask( |
1205 base::Bind(&ThreadProxy::renewTreePriorityOnImplThread, | 1205 base::Bind(&ThreadProxy::renewTreePriorityOnImplThread, |
1206 m_weakFactoryOnImplThread.GetWeakPtr()), | 1206 m_weakFactoryOnImplThread.GetWeakPtr()), |
1207 delay.InMilliseconds()); | 1207 delay.InMilliseconds()); |
1208 | 1208 |
1209 m_renewTreePriorityOnImplThreadPending = true; | 1209 m_renewTreePriorityOnImplThreadPending = true; |
1210 } | 1210 } |
1211 | 1211 |
1212 void ThreadProxy::renewTreePriorityOnImplThread() | 1212 void ThreadProxy::renewTreePriorityOnImplThread() |
1213 { | 1213 { |
1214 DCHECK(m_renewTreePriorityOnImplThreadPending); | 1214 DCHECK(m_renewTreePriorityOnImplThreadPending); |
1215 m_renewTreePriorityOnImplThreadPending = false; | 1215 m_renewTreePriorityOnImplThreadPending = false; |
1216 | 1216 |
1217 renewTreePriority(); | 1217 renewTreePriority(); |
1218 } | 1218 } |
1219 | 1219 |
1220 } // namespace cc | 1220 } // namespace cc |
OLD | NEW |