mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Hoist responsibility for clearMarks/Measures to NativePerformanceObserver (#36312)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/36312 ## Changelog: [Internal] - `clearMarks` and `clearMeasures` methods are incidental to the `NativePerformance` TurboModule functionality, as in reality this responsibility belongs more on the `NativePerformanceObserver` and `PerformanceEntryReporter` side. This is something that [the standard indirectly suggests](https://www.w3.org/TR/user-timing/#clearmarks-method) as well (referencing [performance entry buffer](https://www.w3.org/TR/performance-timeline/#dfn-performance-entry-buffer)). The new implementation should be also a little bit more efficient, as it avoids calling the predicate for each entry. Finally (and frankly, the main reason for this change, from my perspective), it will simplify mocking/testing the JS part of the PerfAPI code. Reviewed By: rubennorte Differential Revision: D43621174 fbshipit-source-id: c4217a0da1d8ecbce797240627f7b4f057d85b97
This commit is contained in:
committed by
Facebook GitHub Bot
parent
5112bc5dbc
commit
14ab76ac30
@@ -32,12 +32,6 @@ void NativePerformance::mark(
|
||||
PerformanceEntryReporter::getInstance().mark(name, startTime, duration);
|
||||
}
|
||||
|
||||
void NativePerformance::clearMarks(
|
||||
jsi::Runtime &rt,
|
||||
std::optional<std::string> markName) {
|
||||
PerformanceEntryReporter::getInstance().clearMarks(markName);
|
||||
}
|
||||
|
||||
void NativePerformance::measure(
|
||||
jsi::Runtime &rt,
|
||||
std::string name,
|
||||
@@ -50,12 +44,6 @@ void NativePerformance::measure(
|
||||
name, startTime, endTime, duration, startMark, endMark);
|
||||
}
|
||||
|
||||
void NativePerformance::clearMeasures(
|
||||
jsi::Runtime &rt,
|
||||
std::optional<std::string> measureName) {
|
||||
PerformanceEntryReporter::getInstance().clearMeasures(measureName);
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, double> NativePerformance::getSimpleMemoryInfo(
|
||||
jsi::Runtime &rt) {
|
||||
auto heapInfo = rt.instrumentation().getHeapInfo(false);
|
||||
|
||||
Reference in New Issue
Block a user