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

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

Issue 946323002: Animations: Introduce compositor AnimationPlayer and AnimationTimeline. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 months 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
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 20 matching lines...) Expand all
31 #include "config.h" 31 #include "config.h"
32 #include "core/animation/AnimationTimeline.h" 32 #include "core/animation/AnimationTimeline.h"
33 33
34 #include "core/animation/ActiveAnimations.h" 34 #include "core/animation/ActiveAnimations.h"
35 #include "core/animation/AnimationClock.h" 35 #include "core/animation/AnimationClock.h"
36 #include "core/dom/Document.h" 36 #include "core/dom/Document.h"
37 #include "core/frame/FrameView.h" 37 #include "core/frame/FrameView.h"
38 #include "core/loader/DocumentLoader.h" 38 #include "core/loader/DocumentLoader.h"
39 #include "core/page/Page.h" 39 #include "core/page/Page.h"
40 #include "platform/TraceEvent.h" 40 #include "platform/TraceEvent.h"
41 #include "public/platform/Platform.h"
42 #include "public/platform/WebCompositorAnimationTimeline.h"
43 #include "public/platform/WebCompositorSupport.h"
41 44
42 namespace blink { 45 namespace blink {
43 46
44 namespace { 47 namespace {
45 48
46 bool compareAnimationPlayers(const RefPtrWillBeMember<blink::AnimationPlayer>& l eft, const RefPtrWillBeMember<blink::AnimationPlayer>& right) 49 bool compareAnimationPlayers(const RefPtrWillBeMember<blink::AnimationPlayer>& l eft, const RefPtrWillBeMember<blink::AnimationPlayer>& right)
47 { 50 {
48 return AnimationPlayer::hasLowerPriority(left.get(), right.get()); 51 return AnimationPlayer::hasLowerPriority(left.get(), right.get());
49 } 52 }
50 53
(...skipping 14 matching lines...) Expand all
65 , m_zeroTime(0) // 0 is used by unit tests which cannot initialize from the loader 68 , m_zeroTime(0) // 0 is used by unit tests which cannot initialize from the loader
66 , m_zeroTimeInitialized(false) 69 , m_zeroTimeInitialized(false)
67 , m_playbackRate(1) 70 , m_playbackRate(1)
68 , m_lastCurrentTimeInternal(0) 71 , m_lastCurrentTimeInternal(0)
69 { 72 {
70 if (!timing) 73 if (!timing)
71 m_timing = adoptPtrWillBeNoop(new AnimationTimelineTiming(this)); 74 m_timing = adoptPtrWillBeNoop(new AnimationTimelineTiming(this));
72 else 75 else
73 m_timing = timing; 76 m_timing = timing;
74 77
78 if (Platform::current()->compositorSupport())
79 m_compositorTimeline = adoptPtr(Platform::current()->compositorSupport() ->createAnimationTimeline());
80
75 ASSERT(document); 81 ASSERT(document);
76 } 82 }
77 83
78 AnimationTimeline::~AnimationTimeline() 84 AnimationTimeline::~AnimationTimeline()
79 { 85 {
80 #if !ENABLE(OILPAN) 86 #if !ENABLE(OILPAN)
81 for (const auto& player : m_players) 87 for (const auto& player : m_players)
82 player->timelineDestroyed(); 88 player->timelineDestroyed();
83 #endif 89 #endif
84 } 90 }
85 91
86 void AnimationTimeline::playerAttached(AnimationPlayer& player) 92 void AnimationTimeline::playerAttached(AnimationPlayer& player)
87 { 93 {
88 ASSERT(player.timeline() == this); 94 ASSERT(player.timeline() == this);
89 ASSERT(!m_players.contains(&player)); 95 ASSERT(!m_players.contains(&player));
90 m_players.add(&player); 96 m_players.add(&player);
97
98 if (m_compositorTimeline)
99 m_compositorTimeline->playerAttached(player);
91 } 100 }
92 101
93 AnimationPlayer* AnimationTimeline::play(AnimationNode* child) 102 AnimationPlayer* AnimationTimeline::play(AnimationNode* child)
94 { 103 {
95 if (!m_document) 104 if (!m_document)
96 return nullptr; 105 return nullptr;
97 106
98 RefPtrWillBeRawPtr<AnimationPlayer> player = AnimationPlayer::create(child, this); 107 RefPtrWillBeRawPtr<AnimationPlayer> player = AnimationPlayer::create(child, this);
99 ASSERT(m_players.contains(player.get())); 108 ASSERT(m_players.contains(player.get()));
100 109
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 { 321 {
313 #if ENABLE(OILPAN) 322 #if ENABLE(OILPAN)
314 visitor->trace(m_document); 323 visitor->trace(m_document);
315 visitor->trace(m_timing); 324 visitor->trace(m_timing);
316 visitor->trace(m_playersNeedingUpdate); 325 visitor->trace(m_playersNeedingUpdate);
317 visitor->trace(m_players); 326 visitor->trace(m_players);
318 #endif 327 #endif
319 } 328 }
320 329
321 } // namespace 330 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698