Index: third_party/WebKit/Source/platform/graphics/BitmapImage.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp |
index f1524ed4ee789d4e4adcd82d0fa19939b901f40e..4ba1b65de95a0a04ac7ac8974e486fb8443411d1 100644 |
--- a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp |
@@ -39,6 +39,7 @@ |
#include "platform/graphics/skia/SkiaUtils.h" |
#include "platform/instrumentation/PlatformInstrumentation.h" |
#include "platform/instrumentation/tracing/TraceEvent.h" |
+#include "platform/scheduler/child/web_scheduler.h" |
#include "platform/wtf/PassRefPtr.h" |
#include "platform/wtf/PtrUtil.h" |
#include "platform/wtf/text/WTFString.h" |
@@ -83,7 +84,11 @@ BitmapImage::BitmapImage(ImageObserver* observer) |
all_data_received_(false), |
have_size_(false), |
size_available_(false), |
- have_frame_count_(false) {} |
+ have_frame_count_(false), |
+ task_runner_(Platform::Current() |
+ ->CurrentThread() |
+ ->Scheduler() |
+ ->CompositorTaskRunner()) {} |
BitmapImage::BitmapImage(const SkBitmap& bitmap, ImageObserver* observer) |
: Image(observer), |
@@ -100,7 +105,11 @@ BitmapImage::BitmapImage(const SkBitmap& bitmap, ImageObserver* observer) |
all_data_received_(true), |
have_size_(true), |
size_available_(true), |
- have_frame_count_(true) { |
+ have_frame_count_(true), |
+ task_runner_(Platform::Current() |
+ ->CurrentThread() |
+ ->Scheduler() |
+ ->CompositorTaskRunner()) { |
// Since we don't have a decoder, we can't figure out the image orientation. |
// Set m_sizeRespectingOrientation to be the same as m_size so it's not 0x0. |
size_respecting_orientation_ = size_; |
@@ -517,8 +526,8 @@ void BitmapImage::StartAnimation(CatchUpAnimation catch_up_if_necessary) { |
if (catch_up_if_necessary == kDoNotCatchUp || |
time < desired_frame_start_time_) { |
// Haven't yet reached time for next frame to start; delay until then. |
- frame_timer_ = WTF::WrapUnique( |
- new Timer<BitmapImage>(this, &BitmapImage::AdvanceAnimation)); |
+ frame_timer_ = WTF::WrapUnique(new TaskRunnerTimer<BitmapImage>( |
+ task_runner_, this, &BitmapImage::AdvanceAnimation)); |
frame_timer_->StartOneShot(std::max(desired_frame_start_time_ - time, 0.), |
BLINK_FROM_HERE); |
} else { |
@@ -548,8 +557,8 @@ void BitmapImage::StartAnimation(CatchUpAnimation catch_up_if_necessary) { |
// may be in the past, meaning the next time through this function we'll |
// kick off the next advancement sooner than this frame's duration would |
// suggest. |
- frame_timer_ = WTF::WrapUnique(new Timer<BitmapImage>( |
- this, &BitmapImage::AdvanceAnimationWithoutCatchUp)); |
+ frame_timer_ = WTF::WrapUnique(new TaskRunnerTimer<BitmapImage>( |
+ task_runner_, this, &BitmapImage::AdvanceAnimationWithoutCatchUp)); |
frame_timer_->StartOneShot(0, BLINK_FROM_HERE); |
} |
} |
@@ -631,8 +640,9 @@ bool BitmapImage::InternalAdvanceAnimation(AnimationAdvancement advancement) { |
// last frame. Skipping frames occurs while painting so we do not |
// synchronously notify the observer which could cause a layout. |
if (advancement == kSkipFramesToCatchUp) { |
- frame_timer_ = WTF::WrapUnique(new Timer<BitmapImage>( |
- this, &BitmapImage::NotifyObserversOfAnimationAdvance)); |
+ frame_timer_ = WTF::WrapUnique(new TaskRunnerTimer<BitmapImage>( |
+ task_runner_, this, |
+ &BitmapImage::NotifyObserversOfAnimationAdvance)); |
frame_timer_->StartOneShot(0, BLINK_FROM_HERE); |
} |