1 // Copyright 2013 The Flutter Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef SHELL_PLATFORM_EMBEDDER_VSYNC_WAITER_EMBEDDER_H_ 6 #define SHELL_PLATFORM_EMBEDDER_VSYNC_WAITER_EMBEDDER_H_ 7 8 #include "flutter/fml/macros.h" 9 #include "flutter/shell/common/vsync_waiter.h" 10 11 namespace flutter { 12 13 class VsyncWaiterEmbedder final : public VsyncWaiter { 14 public: 15 using VsyncCallback = std::function<void(intptr_t)>; 16 17 VsyncWaiterEmbedder(VsyncCallback callback, 18 flutter::TaskRunners task_runners); 19 20 ~VsyncWaiterEmbedder() override; 21 22 static bool OnEmbedderVsync(intptr_t baton, 23 fml::TimePoint frame_start_time, 24 fml::TimePoint frame_target_time); 25 26 private: 27 const VsyncCallback vsync_callback_; 28 29 // |VsyncWaiter| 30 void AwaitVSync() override; 31 32 FML_DISALLOW_COPY_AND_ASSIGN(VsyncWaiterEmbedder); 33 }; 34 35 } // namespace flutter 36 37 #endif // SHELL_PLATFORM_EMBEDDER_VSYNC_WAITER_EMBEDDER_H_ 38