mirror of
https://github.com/wgh136/flutter_qjs.git
synced 2025-09-27 13:27:24 +00:00
init
This commit is contained in:
40
example/windows/runner/run_loop.h
Normal file
40
example/windows/runner/run_loop.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef RUN_LOOP_H_
|
||||
#define RUN_LOOP_H_
|
||||
|
||||
#include <flutter/flutter_view_controller.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <set>
|
||||
|
||||
// A runloop that will service events for Flutter instances as well
|
||||
// as native messages.
|
||||
class RunLoop {
|
||||
public:
|
||||
RunLoop();
|
||||
~RunLoop();
|
||||
|
||||
// Prevent copying
|
||||
RunLoop(RunLoop const&) = delete;
|
||||
RunLoop& operator=(RunLoop const&) = delete;
|
||||
|
||||
// Runs the run loop until the application quits.
|
||||
void Run();
|
||||
|
||||
// Registers the given Flutter instance for event servicing.
|
||||
void RegisterFlutterInstance(
|
||||
flutter::FlutterViewController* flutter_instance);
|
||||
|
||||
// Unregisters the given Flutter instance from event servicing.
|
||||
void UnregisterFlutterInstance(
|
||||
flutter::FlutterViewController* flutter_instance);
|
||||
|
||||
private:
|
||||
using TimePoint = std::chrono::steady_clock::time_point;
|
||||
|
||||
// Processes all currently pending messages for registered Flutter instances.
|
||||
TimePoint ProcessFlutterMessages();
|
||||
|
||||
std::set<flutter::FlutterViewController*> flutter_instances_;
|
||||
};
|
||||
|
||||
#endif // RUN_LOOP_H_
|
Reference in New Issue
Block a user