From 2a7bb12e849e627e2e77b476ed8e20f9694c8283 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Fri, 14 Sep 2018 15:17:09 -0700 Subject: [PATCH] Fabric: Modernizing JSIInstallFabricUIManager Summary: A bunch of different things was changed, but the most important (and need) change is that `UIManager` is now passed in the function as a regular reference, not as a `shared_ptr`. Besides that fact that passing this as `shared_ptr` is simply incorrect (because there is no ownership sharing/transferring here), we need this change because we cannot construct `shared_ptr` from `this` inside `UIManager` class (especially in the constructor). Besides that: * `const &` everything (correctness, explicit intention, performance); * Names were unified with the rest of the code; * `auto` everything; * All JSI stuff is now explicitly prefixed with `jsi::`; * `using` instead of `typedef` (modern C++ syntax); * Lamdas instead of std::bind (same perfromance, much more clear and flexible); Reviewed By: mdvacca Differential Revision: D9835901 fbshipit-source-id: 935be0ae889fe5508ffa9498282c939c816587e1 --- ReactCommon/fabric/uimanager/FabricUIManager.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ReactCommon/fabric/uimanager/FabricUIManager.h b/ReactCommon/fabric/uimanager/FabricUIManager.h index c881ac437..428d6de5b 100644 --- a/ReactCommon/fabric/uimanager/FabricUIManager.h +++ b/ReactCommon/fabric/uimanager/FabricUIManager.h @@ -21,9 +21,8 @@ namespace react { class FabricUIManager; using UIManager = FabricUIManager; -using DispatchEventToEmptyTargetFunction = void (const EventHandler &eventHandler, std::string type, folly::dynamic payload); -using DispatchEventToTargetFunction = void (const EventHandler &eventHandler, const EventTarget &eventTarget, std::string type, folly::dynamic payload); -using ReleaseEventTargetFunction = void (EventTarget eventTarget); +using DispatchEventToEmptyTargetFunction = void (const EventHandler &eventHandler, const std::string &type, const folly::dynamic &payload); +using DispatchEventToTargetFunction = void (const EventHandler &eventHandler, const EventTarget &eventTarget, const std::string &type, const folly::dynamic &payload); class FabricUIManager { public: