mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

Check in linux and windows platform code now that they are stable, so that we could use in devicelab in the future. Removed the ICO from the windows example to avoid analysis check, and since it won't be important for benchmarking or UI tests
45 lines
1.2 KiB
C++
45 lines
1.2 KiB
C++
// Copyright 2014 The Flutter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef RUNNER_RUN_LOOP_H_
|
|
#define RUNNER_RUN_LOOP_H_
|
|
|
|
#include <flutter/flutter_engine.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::FlutterEngine* flutter_instance);
|
|
|
|
// Unregisters the given Flutter instance from event servicing.
|
|
void UnregisterFlutterInstance(
|
|
flutter::FlutterEngine* 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::FlutterEngine*> flutter_instances_;
|
|
};
|
|
|
|
#endif // RUNNER_RUN_LOOP_H_
|