GCTripwireContext.h 843 B

12345678910111213141516171819202122232425262728293031323334
  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. #ifndef HERMES_PUBLIC_GCTRIPWIRECONTEXT_H
  8. #define HERMES_PUBLIC_GCTRIPWIRECONTEXT_H
  9. #include <string>
  10. #include <system_error>
  11. namespace hermes {
  12. namespace vm {
  13. /// Interface passed to the GC tripwire callback when it fires.
  14. class GCTripwireContext {
  15. public:
  16. virtual ~GCTripwireContext() = default;
  17. /// Captures the heap to a file
  18. ///
  19. /// \param path to save the heap capture
  20. ///
  21. /// \return Empty error code if the heap capture succeeded, else a real error
  22. /// code.
  23. virtual std::error_code createSnapshotToFile(const std::string &path) = 0;
  24. };
  25. } // namespace vm
  26. } // namespace hermes
  27. #endif // HERMES_PUBLIC_GCTRIPWIRECONTEXT_H