Skip to content

Commit

Permalink
Fix truncation of frame time on 32-bit Android. (flutter#4040)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmacnak-google authored Aug 31, 2017
1 parent 0c8535e commit cfb8975
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions shell/common/animator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ void Animator::BeginFrame(ftl::TimePoint frame_time) {
// to service potential frame.
FTL_DCHECK(producer_continuation_);

// TODO(abarth): We should use |frame_time| instead, but the frame time we get
// on Android appears to be unstable.
last_begin_frame_time_ = ftl::TimePoint::Now();
last_begin_frame_time_ = frame_time;
engine_->BeginFrame(last_begin_frame_time_);
}

Expand Down
4 changes: 2 additions & 2 deletions shell/platform/android/vsync_waiter_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void VsyncWaiterAndroid::AsyncWaitForVsync(Callback callback) {
});
}

void VsyncWaiterAndroid::OnVsync(long frameTimeNanos) {
void VsyncWaiterAndroid::OnVsync(int64_t frameTimeNanos) {
Callback callback = std::move(callback_);
callback_ = Callback();
blink::Threads::UI()->PostTask([callback, frameTimeNanos] {
Expand All @@ -61,7 +61,7 @@ static void OnNativeVsync(JNIEnv* env,
VsyncWaiterAndroid* waiter = weak->get();
delete weak;
if (waiter) {
waiter->OnVsync(frameTimeNanos);
waiter->OnVsync(static_cast<int64_t>(frameTimeNanos));
}
}

Expand Down
2 changes: 1 addition & 1 deletion shell/platform/android/vsync_waiter_android.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class VsyncWaiterAndroid : public VsyncWaiter {

void AsyncWaitForVsync(Callback callback) override;

void OnVsync(long frameTimeNanos);
void OnVsync(int64_t frameTimeNanos);

private:
Callback callback_;
Expand Down

0 comments on commit cfb8975

Please sign in to comment.