Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: Source/core/animation/DocumentTimeline.cpp

Issue 23874019: Web Animations CSS: Start running animations on the compositor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Cleanup isRunning* and shouldCompositeForAnimation Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 62 }
63 63
64 void DocumentTimeline::add(Player* player) 64 void DocumentTimeline::add(Player* player)
65 { 65 {
66 m_players.append(player); 66 m_players.append(player);
67 67
68 if (m_document->view()) 68 if (m_document->view())
69 m_timing->serviceOnNextFrame(); 69 m_timing->serviceOnNextFrame();
70 } 70 }
71 71
72 PassRefPtr<Player> DocumentTimeline::createPlayer(TimedItem* child)
Steve Block 2013/11/18 05:03:03 This should return a raw pointer, not a PRP. This
dstockwell 2013/11/18 06:11:20 Hmm, maybe I'm confused about how this works. I th
73 {
74 RefPtr<Player> player = Player::create(*this, child);
75 add(player.get());
76 return player.release();
77 }
78
72 PassRefPtr<Player> DocumentTimeline::play(TimedItem* child) 79 PassRefPtr<Player> DocumentTimeline::play(TimedItem* child)
73 { 80 {
74 RefPtr<Player> player = Player::create(*this, child); 81 RefPtr<Player> player = createPlayer(child);
75 player->setStartTime(currentTime()); 82 player->setStartTime(currentTime());
76 add(player.get());
77 return player.release(); 83 return player.release();
78 } 84 }
79 85
80 void DocumentTimeline::wake() 86 void DocumentTimeline::wake()
81 { 87 {
82 m_timing->serviceOnNextFrame(); 88 m_timing->serviceOnNextFrame();
83 } 89 }
84 90
85 bool DocumentTimeline::serviceAnimations() 91 bool DocumentTimeline::serviceAnimations()
86 { 92 {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 void DocumentTimeline::dispatchEvents() 155 void DocumentTimeline::dispatchEvents()
150 { 156 {
151 Vector<EventToDispatch> events = m_events; 157 Vector<EventToDispatch> events = m_events;
152 m_events.clear(); 158 m_events.clear();
153 for (size_t i = 0; i < events.size(); i++) 159 for (size_t i = 0; i < events.size(); i++)
154 events[i].target->dispatchEvent(events[i].event.release()); 160 events[i].target->dispatchEvent(events[i].event.release());
155 } 161 }
156 162
157 size_t DocumentTimeline::numberOfActiveAnimationsForTesting() const 163 size_t DocumentTimeline::numberOfActiveAnimationsForTesting() const
158 { 164 {
165 if (isNull(m_zeroTime))
166 return 0;
159 // Includes all players whose directly associated timed items 167 // Includes all players whose directly associated timed items
160 // are current or in effect. 168 // are current or in effect.
161 return isNull(m_zeroTime) ? 0 : m_players.size(); 169 size_t started = 0;
170 for (size_t i = 0; i < m_players.size(); ++i) {
171 if (m_players[i]->hasStartTime())
172 ++started;
Steve Block 2013/11/18 05:03:03 I think this is wrong, but it was before too. See
dstockwell 2013/11/18 06:11:20 Will wait and rebase.
173 }
174 return started;
162 } 175 }
163 176
164 } // namespace 177 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698