mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Have heap snapshots throw std::system_error instead of return a bool
Summary: Instead of returning a `bool` which gives no information about the cause of the error, return `void` and throw when there's some error. Another alternative is returning `std::error_code`, but that's less flexible than throwing, and this API already supports throwing. Changelog: [Internal] Reviewed By: jbower-fb Differential Revision: D19170033 fbshipit-source-id: 870cd996a1a53c94524455f31765c1da99f57a1d
This commit is contained in:
committed by
Facebook Github Bot
parent
aa41fd5e37
commit
9b7958c2f2
@@ -335,12 +335,12 @@ class RuntimeDecorator : public Base, private jsi::Instrumentation {
|
||||
plain().instrumentation().collectGarbage();
|
||||
}
|
||||
|
||||
bool createSnapshotToFile(const std::string& path) override {
|
||||
return plain().instrumentation().createSnapshotToFile(path);
|
||||
void createSnapshotToFile(const std::string& path) override {
|
||||
plain().instrumentation().createSnapshotToFile(path);
|
||||
}
|
||||
|
||||
bool createSnapshotToStream(std::ostream& os) override {
|
||||
return plain().instrumentation().createSnapshotToStream(os);
|
||||
void createSnapshotToStream(std::ostream& os) override {
|
||||
plain().instrumentation().createSnapshotToStream(os);
|
||||
}
|
||||
|
||||
void writeBridgeTrafficTraceToFile(
|
||||
|
||||
@@ -55,16 +55,12 @@ class Instrumentation {
|
||||
/// Captures the heap to a file
|
||||
///
|
||||
/// \param path to save the heap capture
|
||||
///
|
||||
/// \return true iff the heap capture succeeded
|
||||
virtual bool createSnapshotToFile(const std::string& path) = 0;
|
||||
virtual void createSnapshotToFile(const std::string& path) = 0;
|
||||
|
||||
/// Captures the heap to an output stream
|
||||
///
|
||||
/// \param os output stream to write to.
|
||||
///
|
||||
/// \return true iff the heap capture succeeded.
|
||||
virtual bool createSnapshotToStream(std::ostream& os) = 0;
|
||||
virtual void createSnapshotToStream(std::ostream& os) = 0;
|
||||
|
||||
/// Write a trace of bridge traffic to the given file name.
|
||||
virtual void writeBridgeTrafficTraceToFile(
|
||||
|
||||
@@ -99,12 +99,14 @@ Instrumentation& Runtime::instrumentation() {
|
||||
|
||||
void collectGarbage() override {}
|
||||
|
||||
bool createSnapshotToFile(const std::string&) override {
|
||||
return false;
|
||||
void createSnapshotToFile(const std::string&) override {
|
||||
throw JSINativeException(
|
||||
"Default instrumentation cannot create a heap snapshot");
|
||||
}
|
||||
|
||||
bool createSnapshotToStream(std::ostream&) override {
|
||||
return false;
|
||||
void createSnapshotToStream(std::ostream&) override {
|
||||
throw JSINativeException(
|
||||
"Default instrumentation cannot create a heap snapshot");
|
||||
}
|
||||
|
||||
void writeBridgeTrafficTraceToFile(const std::string&) const override {
|
||||
|
||||
Reference in New Issue
Block a user