• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 FLUTTER_SHELL_PLATFORM_FUCHSIA_VSYNC_WAITER_H_
6 #define FLUTTER_SHELL_PLATFORM_FUCHSIA_VSYNC_WAITER_H_
7 
8 #include <lib/async/cpp/wait.h>
9 
10 #include "flutter/fml/macros.h"
11 #include "flutter/fml/memory/weak_ptr.h"
12 #include "flutter/fml/time/time_point.h"
13 #include "flutter/shell/common/vsync_waiter.h"
14 
15 namespace flutter_runner {
16 
17 class VsyncWaiter final : public flutter::VsyncWaiter {
18  public:
19   static constexpr zx_signals_t SessionPresentSignal = ZX_EVENT_SIGNALED;
20 
21   VsyncWaiter(std::string debug_label,
22               zx_handle_t session_present_handle,
23               flutter::TaskRunners task_runners);
24 
25   ~VsyncWaiter() override;
26 
27  private:
28   const std::string debug_label_;
29   async::Wait session_wait_;
30   fml::WeakPtrFactory<VsyncWaiter> weak_factory_;
31 
32   // |flutter::VsyncWaiter|
33   void AwaitVSync() override;
34 
35   void FireCallbackWhenSessionAvailable();
36 
37   void FireCallbackNow();
38 
39   FML_DISALLOW_COPY_AND_ASSIGN(VsyncWaiter);
40 };
41 
42 }  // namespace flutter_runner
43 
44 #endif  // FLUTTER_SHELL_PLATFORM_FUCHSIA_VSYNC_WAITER_H_
45