mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Expose frame events on PerformanceTracer (#54361)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54361 Expose a couple frame related events on the PerformanceTracer and call setLayerTreeId when tracing starts (needed for DevTools to parse frames) Changelog: [Internal] Reviewed By: rubennorte Differential Revision: D85145809 fbshipit-source-id: 421ee5441041da64f486f5492fa6705b965751f9
This commit is contained in:
1 parent
ce259c5a74
commit
91d4332030
2 files changed
+48
No files matched your search
@@ -360,6 +360,41 @@ void PerformanceTracer::reportResourceFinish(
|
||||
});
|
||||
}
|
||||
|
||||
void PerformanceTracer::setLayerTreeId(std::string frame, int layerTreeId) {
|
||||
enqueueEvent(
|
||||
PerformanceTracerSetLayerTreeIdEvent{
|
||||
.frame = std::move(frame),
|
||||
.layerTreeId = layerTreeId,
|
||||
.start = HighResTimeStamp::now(),
|
||||
.threadId = getCurrentThreadId(),
|
||||
});
|
||||
}
|
||||
|
||||
void PerformanceTracer::reportFrameTiming(
|
||||
int frameSeqId,
|
||||
HighResTimeStamp start,
|
||||
HighResTimeStamp end) {
|
||||
ThreadId threadId = getCurrentThreadId();
|
||||
enqueueEvent(
|
||||
PerformanceTracerFrameBeginDrawEvent{
|
||||
.frameSeqId = frameSeqId,
|
||||
.start = start,
|
||||
.threadId = threadId,
|
||||
});
|
||||
enqueueEvent(
|
||||
PerformanceTracerFrameCommitEvent{
|
||||
.frameSeqId = frameSeqId,
|
||||
.start = start,
|
||||
.threadId = threadId,
|
||||
});
|
||||
enqueueEvent(
|
||||
PerformanceTracerFrameDrawEvent{
|
||||
.frameSeqId = frameSeqId,
|
||||
.start = end,
|
||||
.threadId = threadId,
|
||||
});
|
||||
}
|
||||
|
||||
/* static */ TraceEvent PerformanceTracer::constructRuntimeProfileTraceEvent(
|
||||
RuntimeProfileId profileId,
|
||||
ProcessId processId,
|
||||
|
||||
@@ -161,6 +161,19 @@ class PerformanceTracer {
|
||||
int encodedDataLength,
|
||||
int decodedBodyLength);
|
||||
|
||||
/**
|
||||
* Sets the active layer tree ID in Chrome DevTools. This is needed in
|
||||
* order for frames to be parsed.
|
||||
*
|
||||
* https://chromedevtools.github.io/devtools-protocol/tot/LayerTree/
|
||||
*/
|
||||
void setLayerTreeId(std::string frame, int layerTreeId);
|
||||
|
||||
/**
|
||||
* Reports the required frame CDP events for a given native frame.
|
||||
*/
|
||||
void reportFrameTiming(int frameSeqId, HighResTimeStamp start, HighResTimeStamp end);
|
||||
|
||||
/**
|
||||
* Creates "Profile" Trace Event.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user