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

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

Issue 225073004: Oilpan: Completely move core/animations/ to oilpan's heap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | 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 30 matching lines...) Expand all
41 namespace { 41 namespace {
42 42
43 static unsigned nextSequenceNumber() 43 static unsigned nextSequenceNumber()
44 { 44 {
45 static unsigned next = 0; 45 static unsigned next = 0;
46 return ++next; 46 return ++next;
47 } 47 }
48 48
49 } 49 }
50 50
51 PassRefPtr<AnimationPlayer> AnimationPlayer::create(DocumentTimeline& timeline, TimedItem* content) 51 PassRefPtrWillBeRawPtr<AnimationPlayer> AnimationPlayer::create(DocumentTimeline & timeline, TimedItem* content)
52 { 52 {
53 return adoptRef(new AnimationPlayer(timeline, content)); 53 return adoptRefWillBeRefCountedGarbageCollected(new AnimationPlayer(timeline , content));
54 } 54 }
55 55
56 AnimationPlayer::AnimationPlayer(DocumentTimeline& timeline, TimedItem* content) 56 AnimationPlayer::AnimationPlayer(DocumentTimeline& timeline, TimedItem* content)
57 : m_playbackRate(1) 57 : m_playbackRate(1)
58 , m_startTime(nullValue()) 58 , m_startTime(nullValue())
59 , m_holdTime(nullValue()) 59 , m_holdTime(nullValue())
60 , m_storedTimeLag(0) 60 , m_storedTimeLag(0)
61 , m_sortInfo(nextSequenceNumber(), timeline.effectiveTime()) 61 , m_sortInfo(nextSequenceNumber(), timeline.effectiveTime())
62 , m_content(content) 62 , m_content(content)
63 , m_timeline(&timeline) 63 , m_timeline(&timeline)
64 , m_paused(false) 64 , m_paused(false)
65 , m_held(false) 65 , m_held(false)
66 , m_isPausedForTesting(false) 66 , m_isPausedForTesting(false)
67 , m_outdated(false) 67 , m_outdated(false)
68 , m_finished(false) 68 , m_finished(false)
69 { 69 {
70 if (m_content) { 70 if (m_content) {
71 if (m_content->player()) 71 if (m_content->player())
72 m_content->player()->cancel(); 72 m_content->player()->cancel();
73 m_content->attach(this); 73 m_content->attach(this);
74 } 74 }
75 } 75 }
76 76
77 AnimationPlayer::~AnimationPlayer() 77 AnimationPlayer::~AnimationPlayer()
78 { 78 {
79 #if !ENABLE(OILPAN)
79 if (m_content) 80 if (m_content)
80 m_content->detach(); 81 m_content->detach();
81 if (m_timeline) 82 if (m_timeline)
82 m_timeline->playerDestroyed(this); 83 m_timeline->playerDestroyed(this);
84 #endif
83 } 85 }
84 86
85 double AnimationPlayer::sourceEnd() const 87 double AnimationPlayer::sourceEnd() const
86 { 88 {
87 return m_content ? m_content->endTime() : 0; 89 return m_content ? m_content->endTime() : 0;
88 } 90 }
89 91
90 bool AnimationPlayer::limited(double currentTime) const 92 bool AnimationPlayer::limited(double currentTime) const
91 { 93 {
92 return (m_playbackRate < 0 && currentTime <= 0) || (m_playbackRate > 0 && cu rrentTime >= sourceEnd()); 94 return (m_playbackRate < 0 && currentTime <= 0) || (m_playbackRate > 0 && cu rrentTime >= sourceEnd());
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 bool AnimationPlayer::SortInfo::operator<(const SortInfo& other) const 366 bool AnimationPlayer::SortInfo::operator<(const SortInfo& other) const
365 { 367 {
366 ASSERT(!std::isnan(m_startTime) && !std::isnan(other.m_startTime)); 368 ASSERT(!std::isnan(m_startTime) && !std::isnan(other.m_startTime));
367 if (m_startTime < other.m_startTime) 369 if (m_startTime < other.m_startTime)
368 return true; 370 return true;
369 if (m_startTime > other.m_startTime) 371 if (m_startTime > other.m_startTime)
370 return false; 372 return false;
371 return m_sequenceNumber < other.m_sequenceNumber; 373 return m_sequenceNumber < other.m_sequenceNumber;
372 } 374 }
373 375
376 #if !ENABLE(OILPAN)
374 bool AnimationPlayer::canFree() const 377 bool AnimationPlayer::canFree() const
375 { 378 {
376 ASSERT(m_content); 379 ASSERT(m_content);
377 return hasOneRef() && m_content->isAnimation() && m_content->hasOneRef(); 380 return hasOneRef() && m_content->isAnimation() && m_content->hasOneRef();
378 } 381 }
382 #endif
379 383
380 bool AnimationPlayer::addEventListener(const AtomicString& eventType, PassRefPtr <EventListener> listener, bool useCapture) 384 bool AnimationPlayer::addEventListener(const AtomicString& eventType, PassRefPtr <EventListener> listener, bool useCapture)
381 { 385 {
382 if (eventType == EventTypeNames::finish) 386 if (eventType == EventTypeNames::finish)
383 UseCounter::count(executionContext(), UseCounter::AnimationPlayerFinishE vent); 387 UseCounter::count(executionContext(), UseCounter::AnimationPlayerFinishE vent);
384 return EventTargetWithInlineData::addEventListener(eventType, listener, useC apture); 388 return EventTargetWithInlineData::addEventListener(eventType, listener, useC apture);
385 } 389 }
386 390
387 void AnimationPlayer::pauseForTesting(double pauseTime) 391 void AnimationPlayer::pauseForTesting(double pauseTime)
388 { 392 {
389 RELEASE_ASSERT(!paused()); 393 RELEASE_ASSERT(!paused());
390 updateTimingState(pauseTime); 394 updateTimingState(pauseTime);
391 if (!m_isPausedForTesting && hasActiveAnimationsOnCompositor()) 395 if (!m_isPausedForTesting && hasActiveAnimationsOnCompositor())
392 toAnimation(m_content.get())->pauseAnimationForTestingOnCompositor(curre ntTime()); 396 toAnimation(m_content.get())->pauseAnimationForTestingOnCompositor(curre ntTime());
393 m_isPausedForTesting = true; 397 m_isPausedForTesting = true;
394 pause(); 398 pause();
395 } 399 }
396 400
401 void AnimationPlayer::trace(Visitor* visitor)
402 {
403 visitor->trace(m_content);
404 visitor->trace(m_timeline);
405 }
406
397 } // namespace 407 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698