diff --git a/ReactCommon/jsi/jsi/decorator.h b/ReactCommon/jsi/jsi/decorator.h index b31615212d4..819ac5cdf62 100644 --- a/ReactCommon/jsi/jsi/decorator.h +++ b/ReactCommon/jsi/jsi/decorator.h @@ -325,7 +325,8 @@ class RuntimeDecorator : public Base, private jsi::Instrumentation { return plain().instrumentation().getRecordedGCStats(); } - Value getHeapInfo(bool includeExpensive) override { + std::unordered_map getHeapInfo( + bool includeExpensive) override { return plain().instrumentation().getHeapInfo(includeExpensive); } diff --git a/ReactCommon/jsi/jsi/instrumentation.h b/ReactCommon/jsi/jsi/instrumentation.h index 08402254408..9e9c980315b 100644 --- a/ReactCommon/jsi/jsi/instrumentation.h +++ b/ReactCommon/jsi/jsi/instrumentation.h @@ -8,6 +8,7 @@ #include #include +#include #include @@ -17,6 +18,8 @@ namespace jsi { /// Methods for starting and collecting instrumentation, an \c Instrumentation /// instance is associated with a particular \c Runtime instance, which it /// controls the instrumentation of. +/// None of these functions should return newly created jsi values, nor should +/// it modify the values of any jsi values in the heap (although GCs are fine). class Instrumentation { public: virtual ~Instrumentation() = default; @@ -40,9 +43,10 @@ class Instrumentation { /// function can be called at any time, and should produce information that is /// correct at the instant it is called (i.e, not stale). /// - /// \return a jsi Value containing whichever statistics the runtime supports - /// for its heap. - virtual Value getHeapInfo(bool includeExpensive) = 0; + /// \return a map from a string key to a number associated with that + /// statistic. + virtual std::unordered_map getHeapInfo( + bool includeExpensive) = 0; /// perform a full garbage collection virtual void collectGarbage() = 0; diff --git a/ReactCommon/jsi/jsi/jsi.cpp b/ReactCommon/jsi/jsi/jsi.cpp index 408b321c542..0b8cb80b388 100644 --- a/ReactCommon/jsi/jsi/jsi.cpp +++ b/ReactCommon/jsi/jsi/jsi.cpp @@ -71,8 +71,8 @@ Instrumentation& Runtime::instrumentation() { return ""; } - Value getHeapInfo(bool) override { - return Value::undefined(); + std::unordered_map getHeapInfo(bool) override { + return std::unordered_map{}; } void collectGarbage() override {}