OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 namespace { | 46 namespace { |
47 | 47 |
48 void updateAnimationTiming(Document& document, TimingUpdateReason reason) | 48 void updateAnimationTiming(Document& document, TimingUpdateReason reason) |
49 { | 49 { |
50 document.timeline().serviceAnimations(reason); | 50 document.timeline().serviceAnimations(reason); |
51 } | 51 } |
52 | 52 |
53 } // namespace | 53 } // namespace |
54 | 54 |
55 void DocumentAnimations::updateAnimationTimingForAnimationFrame(Document& docume
nt, double monotonicAnimationStartTime) | 55 void DocumentAnimations::updateAnimationTimingForAnimationFrame(Document& docume
nt) |
56 { | 56 { |
57 document.animationClock().updateTime(monotonicAnimationStartTime); | |
58 updateAnimationTiming(document, TimingUpdateForAnimationFrame); | 57 updateAnimationTiming(document, TimingUpdateForAnimationFrame); |
59 } | 58 } |
60 | 59 |
61 bool DocumentAnimations::needsAnimationTimingUpdate(const Document& document) | 60 bool DocumentAnimations::needsAnimationTimingUpdate(const Document& document) |
62 { | 61 { |
63 return document.timeline().hasOutdatedAnimation() || document.timeline().nee
dsAnimationTimingUpdate(); | 62 return document.timeline().hasOutdatedAnimation() || document.timeline().nee
dsAnimationTimingUpdate(); |
64 } | 63 } |
65 | 64 |
66 void DocumentAnimations::updateAnimationTimingIfNeeded(Document& document) | 65 void DocumentAnimations::updateAnimationTimingIfNeeded(Document& document) |
67 { | 66 { |
68 if (needsAnimationTimingUpdate(document)) | 67 if (needsAnimationTimingUpdate(document)) |
69 updateAnimationTiming(document, TimingUpdateOnDemand); | 68 updateAnimationTiming(document, TimingUpdateOnDemand); |
70 } | 69 } |
71 | 70 |
72 void DocumentAnimations::updateCompositorAnimations(Document& document) | 71 void DocumentAnimations::updateCompositorAnimations(Document& document) |
73 { | 72 { |
74 ASSERT(document.lifecycle().state() == DocumentLifecycle::CompositingClean); | 73 ASSERT(document.lifecycle().state() == DocumentLifecycle::CompositingClean); |
75 if (document.compositorPendingAnimations().update()) { | 74 if (document.compositorPendingAnimations().update()) { |
76 ASSERT(document.view()); | 75 ASSERT(document.view()); |
77 document.view()->scheduleAnimation(); | 76 document.view()->scheduleAnimation(); |
78 } | 77 } |
79 | 78 |
80 document.timeline().scheduleNextService(); | 79 document.timeline().scheduleNextService(); |
81 } | 80 } |
82 | 81 |
83 } // namespace blink | 82 } // namespace blink |
OLD | NEW |