Flutter Engine
vsync_waiter.h
Go to the documentation of this file.
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_FLUTTER_VSYNC_WAITER_H_
6 #define FLUTTER_SHELL_PLATFORM_FUCHSIA_FLUTTER_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_delta.h"
13 #include "flutter/fml/time/time_point.h"
14 #include "flutter/shell/common/vsync_waiter.h"
16 
17 namespace flutter_runner {
18 
20  std::function<void(fml::TimePoint, fml::TimePoint)>;
21 
22 using AwaitVsyncCallback = std::function<void(FireCallbackCallback)>;
23 
25  std::function<void(FireCallbackCallback)>;
26 
27 class VsyncWaiter final : public flutter::VsyncWaiter {
28  public:
29  VsyncWaiter(AwaitVsyncCallback await_vsync_callback,
31  await_vsync_for_secondary_callback_callback,
32  flutter::TaskRunners task_runners);
33 
34  ~VsyncWaiter() override;
35 
36  private:
37  // |flutter::VsyncWaiter|
38  void AwaitVSync() override;
39 
40  // |flutter::VsyncWaiter|
41  void AwaitVSyncForSecondaryCallback() override;
42 
43  FireCallbackCallback fire_callback_callback_;
44 
45  AwaitVsyncCallback await_vsync_callback_;
47  await_vsync_for_secondary_callback_callback_;
48 
50  std::unique_ptr<fml::WeakPtrFactory<VsyncWaiter>> weak_factory_ui_;
52 
53  FML_DISALLOW_COPY_AND_ASSIGN(VsyncWaiter);
54 };
55 
56 } // namespace flutter_runner
57 
58 #endif // FLUTTER_SHELL_PLATFORM_FUCHSIA_FLUTTER_VSYNC_WAITER_H_
std::function< void(FireCallbackCallback)> AwaitVsyncForSecondaryCallbackCallback
Definition: vsync_waiter.h:25
std::function< void(FireCallbackCallback)> AwaitVsyncCallback
Definition: vsync_waiter.h:22
std::function< void(fml::TimePoint, fml::TimePoint)> FireCallbackCallback
Definition: vsync_waiter.h:20
VsyncWaiter(AwaitVsyncCallback await_vsync_callback, AwaitVsyncForSecondaryCallbackCallback await_vsync_for_secondary_callback_callback, flutter::TaskRunners task_runners)
Definition: vsync_waiter.cc:21