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

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, 7 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(true) 67 , m_outdated(true)
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->endTimeInternal() : 0; 89 return m_content ? m_content->endTimeInternal() : 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 bool AnimationPlayer::SortInfo::operator<(const SortInfo& other) const 399 bool AnimationPlayer::SortInfo::operator<(const SortInfo& other) const
398 { 400 {
399 ASSERT(!std::isnan(m_startTime) && !std::isnan(other.m_startTime)); 401 ASSERT(!std::isnan(m_startTime) && !std::isnan(other.m_startTime));
400 if (m_startTime < other.m_startTime) 402 if (m_startTime < other.m_startTime)
401 return true; 403 return true;
402 if (m_startTime > other.m_startTime) 404 if (m_startTime > other.m_startTime)
403 return false; 405 return false;
404 return m_sequenceNumber < other.m_sequenceNumber; 406 return m_sequenceNumber < other.m_sequenceNumber;
405 } 407 }
406 408
409 #if !ENABLE(OILPAN)
407 bool AnimationPlayer::canFree() const 410 bool AnimationPlayer::canFree() const
408 { 411 {
409 ASSERT(m_content); 412 ASSERT(m_content);
410 return hasOneRef() && m_content->isAnimation() && m_content->hasOneRef(); 413 return hasOneRef() && m_content->isAnimation() && m_content->hasOneRef();
411 } 414 }
415 #endif
412 416
413 bool AnimationPlayer::addEventListener(const AtomicString& eventType, PassRefPtr <EventListener> listener, bool useCapture) 417 bool AnimationPlayer::addEventListener(const AtomicString& eventType, PassRefPtr <EventListener> listener, bool useCapture)
414 { 418 {
415 if (eventType == EventTypeNames::finish) 419 if (eventType == EventTypeNames::finish)
416 UseCounter::count(executionContext(), UseCounter::AnimationPlayerFinishE vent); 420 UseCounter::count(executionContext(), UseCounter::AnimationPlayerFinishE vent);
417 return EventTargetWithInlineData::addEventListener(eventType, listener, useC apture); 421 return EventTargetWithInlineData::addEventListener(eventType, listener, useC apture);
418 } 422 }
419 423
420 void AnimationPlayer::pauseForTesting(double pauseTime) 424 void AnimationPlayer::pauseForTesting(double pauseTime)
421 { 425 {
422 RELEASE_ASSERT(!paused()); 426 RELEASE_ASSERT(!paused());
423 updateTimingState(pauseTime); 427 updateTimingState(pauseTime);
424 if (!m_isPausedForTesting && hasActiveAnimationsOnCompositor()) 428 if (!m_isPausedForTesting && hasActiveAnimationsOnCompositor())
425 toAnimation(m_content.get())->pauseAnimationForTestingOnCompositor(curre ntTimeInternal()); 429 toAnimation(m_content.get())->pauseAnimationForTestingOnCompositor(curre ntTimeInternal());
426 m_isPausedForTesting = true; 430 m_isPausedForTesting = true;
427 pause(); 431 pause();
428 } 432 }
429 433
434 void AnimationPlayer::trace(Visitor* visitor)
435 {
436 visitor->trace(m_content);
437 visitor->trace(m_timeline);
438 }
439
430 } // namespace 440 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698