Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. diff --git a/shell/common/vsync_waiter.cc b/shell/common/vsync_waiter.cc
  2. index b6b55df11..2a21d3fd9 100644
  3. --- a/shell/common/vsync_waiter.cc
  4. +++ b/shell/common/vsync_waiter.cc
  5. @@ -28,9 +28,23 @@ VsyncWaiter::VsyncWaiter(blink::TaskRunners task_runners)
  6.  
  7. VsyncWaiter::~VsyncWaiter() = default;
  8.  
  9. +// Public method invoked by the animator.
  10. void VsyncWaiter::AsyncWaitForVsync(Callback callback) {
  11. + if (!callback) {
  12. + return;
  13. + }
  14. +
  15. + TRACE_EVENT0("flutter", "AsyncWaitForVsync");
  16. +
  17. {
  18. std::lock_guard<std::mutex> lock(callback_mutex_);
  19. + if (callback_) {
  20. + // The animator may request a frame more than once within a frame
  21. + // interval. Multiple calls to request frame must result in a single
  22. + // callback per frame interval.
  23. + TRACE_EVENT_INSTANT0("flutter", "MultipleCallsToVsyncInFrameInterval");
  24. + return;
  25. + }
  26. callback_ = std::move(callback);
  27. }
  28. AwaitVSync();
  29. @@ -46,6 +60,10 @@ void VsyncWaiter::FireCallback(fml::TimePoint frame_start_time,
  30. }
  31.  
  32. if (!callback) {
  33. + // This means that the vsync waiter implementation fired a callback for a
  34. + // request we did not make. This is a paranoid check but we still want to
  35. + // make sure we catch misbehaving vsync implementations.
  36. + TRACE_EVENT_INSTANT0("flutter", "MismatchedFrameCallback");
  37. return;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement