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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/BitmapImage.cpp

Issue 2547053003: s/ passed(...) / WTF::passed(...) / to avoid future ambiguity w/ base::Passed. (Closed)
Patch Set: Rebasing... Created 4 years 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) 2006 Samuel Weinig (sam.weinig@gmail.com) 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 // the other hand, it makes animations "less accurate" for pages that try to 483 // the other hand, it makes animations "less accurate" for pages that try to
484 // sync an image and some other resource (e.g. audio), especially if users 484 // sync an image and some other resource (e.g. audio), especially if users
485 // switch tabs (and thus stop drawing the animation, which will pause it) 485 // switch tabs (and thus stop drawing the animation, which will pause it)
486 // during that initial loop, then switch back later. 486 // during that initial loop, then switch back later.
487 if (nextFrame == 0 && m_repetitionsComplete == 0 && 487 if (nextFrame == 0 && m_repetitionsComplete == 0 &&
488 m_desiredFrameStartTime < time) 488 m_desiredFrameStartTime < time)
489 m_desiredFrameStartTime = time; 489 m_desiredFrameStartTime = time;
490 490
491 if (catchUpIfNecessary == DoNotCatchUp || time < m_desiredFrameStartTime) { 491 if (catchUpIfNecessary == DoNotCatchUp || time < m_desiredFrameStartTime) {
492 // Haven't yet reached time for next frame to start; delay until then. 492 // Haven't yet reached time for next frame to start; delay until then.
493 m_frameTimer = wrapUnique( 493 m_frameTimer = WTF::wrapUnique(
494 new Timer<BitmapImage>(this, &BitmapImage::advanceAnimation)); 494 new Timer<BitmapImage>(this, &BitmapImage::advanceAnimation));
495 m_frameTimer->startOneShot(std::max(m_desiredFrameStartTime - time, 0.), 495 m_frameTimer->startOneShot(std::max(m_desiredFrameStartTime - time, 0.),
496 BLINK_FROM_HERE); 496 BLINK_FROM_HERE);
497 } else { 497 } else {
498 // We've already reached or passed the time for the next frame to start. 498 // We've already reached or passed the time for the next frame to start.
499 // See if we've also passed the time for frames after that to start, in 499 // See if we've also passed the time for frames after that to start, in
500 // case we need to skip some frames entirely. Remember not to advance 500 // case we need to skip some frames entirely. Remember not to advance
501 // to an incomplete frame. 501 // to an incomplete frame.
502 for (size_t frameAfterNext = (nextFrame + 1) % frameCount(); 502 for (size_t frameAfterNext = (nextFrame + 1) % frameCount();
503 frameIsCompleteAtIndex(frameAfterNext); 503 frameIsCompleteAtIndex(frameAfterNext);
(...skipping 10 matching lines...) Expand all
514 return; 514 return;
515 } 515 }
516 m_desiredFrameStartTime = frameAfterNextStartTime; 516 m_desiredFrameStartTime = frameAfterNextStartTime;
517 nextFrame = frameAfterNext; 517 nextFrame = frameAfterNext;
518 } 518 }
519 519
520 // Post a task to advance the frame immediately. m_desiredFrameStartTime 520 // Post a task to advance the frame immediately. m_desiredFrameStartTime
521 // may be in the past, meaning the next time through this function we'll 521 // may be in the past, meaning the next time through this function we'll
522 // kick off the next advancement sooner than this frame's duration would 522 // kick off the next advancement sooner than this frame's duration would
523 // suggest. 523 // suggest.
524 m_frameTimer = wrapUnique(new Timer<BitmapImage>( 524 m_frameTimer = WTF::wrapUnique(new Timer<BitmapImage>(
525 this, &BitmapImage::advanceAnimationWithoutCatchUp)); 525 this, &BitmapImage::advanceAnimationWithoutCatchUp));
526 m_frameTimer->startOneShot(0, BLINK_FROM_HERE); 526 m_frameTimer->startOneShot(0, BLINK_FROM_HERE);
527 } 527 }
528 } 528 }
529 529
530 void BitmapImage::stopAnimation() { 530 void BitmapImage::stopAnimation() {
531 // This timer is used to animate all occurrences of this image. Don't 531 // This timer is used to animate all occurrences of this image. Don't
532 // invalidate the timer unless all renderers have stopped drawing. 532 // invalidate the timer unless all renderers have stopped drawing.
533 m_frameTimer.reset(); 533 m_frameTimer.reset();
534 } 534 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 m_animationPolicy == ImageAnimationPolicyAnimateOnce) { 597 m_animationPolicy == ImageAnimationPolicyAnimateOnce) {
598 m_animationFinished = true; 598 m_animationFinished = true;
599 m_desiredFrameStartTime = 0; 599 m_desiredFrameStartTime = 0;
600 600
601 // We skipped to the last frame and cannot advance further. The 601 // We skipped to the last frame and cannot advance further. The
602 // observer will not receive animationAdvanced notifications while 602 // observer will not receive animationAdvanced notifications while
603 // skipping but we still need to notify the observer to draw the 603 // skipping but we still need to notify the observer to draw the
604 // last frame. Skipping frames occurs while painting so we do not 604 // last frame. Skipping frames occurs while painting so we do not
605 // synchronously notify the observer which could cause a layout. 605 // synchronously notify the observer which could cause a layout.
606 if (advancement == SkipFramesToCatchUp) { 606 if (advancement == SkipFramesToCatchUp) {
607 m_frameTimer = wrapUnique(new Timer<BitmapImage>( 607 m_frameTimer = WTF::wrapUnique(new Timer<BitmapImage>(
608 this, &BitmapImage::notifyObserversOfAnimationAdvance)); 608 this, &BitmapImage::notifyObserversOfAnimationAdvance));
609 m_frameTimer->startOneShot(0, BLINK_FROM_HERE); 609 m_frameTimer->startOneShot(0, BLINK_FROM_HERE);
610 } 610 }
611 611
612 return false; 612 return false;
613 } 613 }
614 614
615 // Loop the animation back to the first frame. 615 // Loop the animation back to the first frame.
616 m_currentFrame = 0; 616 m_currentFrame = 0;
617 } 617 }
618 618
619 // We need to draw this frame if we advanced to it while not skipping. 619 // We need to draw this frame if we advanced to it while not skipping.
620 if (advancement != SkipFramesToCatchUp) 620 if (advancement != SkipFramesToCatchUp)
621 getImageObserver()->animationAdvanced(this); 621 getImageObserver()->animationAdvanced(this);
622 622
623 return true; 623 return true;
624 } 624 }
625 625
626 void BitmapImage::notifyObserversOfAnimationAdvance(TimerBase*) { 626 void BitmapImage::notifyObserversOfAnimationAdvance(TimerBase*) {
627 getImageObserver()->animationAdvanced(this); 627 getImageObserver()->animationAdvanced(this);
628 } 628 }
629 629
630 } // namespace blink 630 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698