Partially remove dependency on folly async
Summary: This change isolates the usage of folly async from Flipper. Is now self-contained in Flipper Folly schedulers. Users of Flipper can decide not to use the types defined in that header and implement their own. NOTE: changes are minimal, we are just replacing direct calls to folly event base with a scheduler which simply relays this on to folly. Reviewed By: fabiomassimo Differential Revision: D36052198 fbshipit-source-id: 170d64a324a1f1f100224e2622a59cbac3c8b642
This commit is contained in:
committed by
Facebook GitHub Bot
parent
216c926ca5
commit
ade685c621
@@ -10,9 +10,8 @@
|
||||
#import "FlipperClient.h"
|
||||
#import <Flipper/FlipperCertificateProvider.h>
|
||||
#import <Flipper/FlipperClient.h>
|
||||
#import <Flipper/FlipperFollyScopedThreadScheduler.h>
|
||||
#import <Flipper/FlipperSocketProvider.h>
|
||||
#include <folly/io/async/EventBase.h>
|
||||
#include <folly/io/async/ScopedEventBaseThread.h>
|
||||
#include <memory>
|
||||
#import "FlipperClient+Testing.h"
|
||||
#import "FlipperCppWrapperPlugin.h"
|
||||
@@ -32,8 +31,9 @@ using WrapperPlugin = facebook::flipper::FlipperCppWrapperPlugin;
|
||||
|
||||
@implementation FlipperClient {
|
||||
facebook::flipper::FlipperClient* _cppClient;
|
||||
folly::ScopedEventBaseThread sonarThread;
|
||||
folly::ScopedEventBaseThread connectionThread;
|
||||
std::unique_ptr<facebook::flipper::Scheduler> sonarScheduler;
|
||||
std::unique_ptr<facebook::flipper::Scheduler> connectionScheduler;
|
||||
|
||||
id<FlipperKitCertificateProvider> _certProvider;
|
||||
#if !TARGET_OS_OSX && !TARGET_OS_SIMULATOR && !TARGET_OS_MACCATALYST
|
||||
FKPortForwardingServer* _secureServer;
|
||||
@@ -90,6 +90,10 @@ using WrapperPlugin = facebook::flipper::FlipperCppWrapperPlugin;
|
||||
deviceName = [[NSHost currentHost] localizedName];
|
||||
#endif
|
||||
|
||||
sonarScheduler =
|
||||
std::make_unique<facebook::flipper::FollyScopedThreadScheduler>();
|
||||
connectionScheduler =
|
||||
std::make_unique<facebook::flipper::FollyScopedThreadScheduler>();
|
||||
static const std::string UNKNOWN = std::string("unknown");
|
||||
try {
|
||||
facebook::flipper::FlipperClient::init(
|
||||
@@ -102,8 +106,8 @@ using WrapperPlugin = facebook::flipper::FlipperCppWrapperPlugin;
|
||||
[appId UTF8String] ?: UNKNOWN,
|
||||
[privateAppDirectory UTF8String],
|
||||
},
|
||||
sonarThread.getEventBase(),
|
||||
connectionThread.getEventBase(),
|
||||
sonarScheduler.get(),
|
||||
connectionScheduler.get(),
|
||||
[SKEnvironmentVariables getInsecurePort],
|
||||
[SKEnvironmentVariables getSecurePort],
|
||||
[SKEnvironmentVariables getAltInsecurePort],
|
||||
|
||||
Reference in New Issue
Block a user