SchedulerDelegate.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #pragma once
  8. #include <memory>
  9. #include <react/core/ReactPrimitives.h>
  10. #include <react/mounting/MountingCoordinator.h>
  11. #include <react/mounting/ShadowView.h>
  12. namespace facebook {
  13. namespace react {
  14. /*
  15. * Abstract class for Scheduler's delegate.
  16. */
  17. class SchedulerDelegate {
  18. public:
  19. /*
  20. * Called right after Scheduler computed (and laid out) a new updated version
  21. * of the tree and calculated a set of mutations which are sufficient
  22. * to construct a new one.
  23. */
  24. virtual void schedulerDidFinishTransaction(
  25. MountingCoordinator::Shared const &mountingCoordinator) = 0;
  26. /*
  27. * Called right after a new ShadowNode was created.
  28. */
  29. virtual void schedulerDidRequestPreliminaryViewAllocation(
  30. SurfaceId surfaceId,
  31. const ShadowView &shadowView) = 0;
  32. virtual void schedulerDidDispatchCommand(
  33. const ShadowView &shadowView,
  34. std::string const &commandName,
  35. folly::dynamic const args) = 0;
  36. /*
  37. * Set JS responder for a view
  38. */
  39. virtual void schedulerDidSetJSResponder(
  40. SurfaceId surfaceId,
  41. const ShadowView &shadowView,
  42. const ShadowView &initialShadowView,
  43. bool blockNativeResponder) = 0;
  44. /*
  45. * Clear the JSResponder for a view
  46. */
  47. virtual void schedulerDidClearJSResponder() = 0;
  48. virtual ~SchedulerDelegate() noexcept = default;
  49. };
  50. } // namespace react
  51. } // namespace facebook