Summary: ^ This diff brings most things together and can be considered the test platform for RNW. With this, Flipper client gets initialised and started. This means the application connects and is ready for debugging. Reviewed By: antonk52 Differential Revision: D39054912 fbshipit-source-id: 94397f6a72b1e9d9c0f2f3efaf9967be525076cd
46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <ReactDispatcher.h>
|
|
#include <winrt/Microsoft.ReactNative.h>
|
|
#include <thread>
|
|
#include "../../../../xplat/Flipper/FlipperScheduler.h"
|
|
|
|
using namespace winrt::Microsoft::ReactNative;
|
|
|
|
namespace facebook {
|
|
namespace flipper {
|
|
|
|
struct FlipperReactScheduler : public Scheduler {
|
|
FlipperReactScheduler()
|
|
: dispatcher_(ReactDispatcher::CreateSerialDispatcher()) {}
|
|
virtual ~FlipperReactScheduler() {}
|
|
|
|
virtual void schedule(facebook::flipper::Func&& t) override {
|
|
dispatcher_.Post([t]() { t(); });
|
|
}
|
|
virtual void scheduleAfter(facebook::flipper::Func&& t, unsigned int ms)
|
|
override {
|
|
dispatcher_.Post([t, ms]() {
|
|
std::this_thread::sleep_for(std::chrono::microseconds(ms));
|
|
t();
|
|
});
|
|
}
|
|
|
|
virtual bool isRunningInOwnThread() override {
|
|
return true;
|
|
}
|
|
|
|
private:
|
|
ReactDispatcher dispatcher_;
|
|
};
|
|
|
|
} // namespace flipper
|
|
} // namespace facebook
|