ShadowTreeRevision.h 1.4 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 <better/optional.h>
  9. #include <react/mounting/MountingTelemetry.h>
  10. #include <react/mounting/MountingTransaction.h>
  11. #include <react/mounting/ShadowViewMutation.h>
  12. namespace facebook {
  13. namespace react {
  14. /*
  15. * Represent a particular committed state of a shadow tree. The object contains
  16. * a pointer to a root shadow node, a sequential number of commit and telemetry.
  17. */
  18. class ShadowTreeRevision final {
  19. public:
  20. /*
  21. * Sequential number of the commit that created this revision of a shadow
  22. * tree.
  23. */
  24. using Number = int64_t;
  25. /*
  26. * Creates the object with given root shadow node, revision number and
  27. * telemetry.
  28. */
  29. ShadowTreeRevision(
  30. ShadowNode::Shared const &rootShadowNode,
  31. Number number,
  32. MountingTelemetry telemetry);
  33. /*
  34. * Returns telemetry associated with this revision.
  35. */
  36. MountingTelemetry const &getTelemetry() const;
  37. private:
  38. friend class MountingCoordinator;
  39. /*
  40. * Methods from this section are meant to be used by `MountingCoordinator`
  41. * only.
  42. */
  43. ShadowNode const &getRootShadowNode();
  44. Number getNumber() const;
  45. private:
  46. ShadowNode::Shared rootShadowNode_;
  47. Number number_;
  48. MountingTelemetry telemetry_;
  49. };
  50. } // namespace react
  51. } // namespace facebook