Stub support for Tracing start/end methods and events (#44004)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44004

Changelog: [Internal]

Adds the minimal boilerplate needed to support taking an (empty) recording using Chrome DevTools's Performance panel.

Reviewed By: hoxyq

Differential Revision: D55925170

fbshipit-source-id: 8f5048bd545be3ef410b794573ef7b7bc92f73cc
This commit is contained in:
Moti Zilberman
2024-04-10 04:04:12 -07:00
committed by Facebook GitHub Bot
parent 27ef6cdbaf
commit 403bbae1f2
@@ -116,6 +116,26 @@ void HostAgent::handleRequest(const cdp::PreparsedRequest& req) {
shouldSendOKResponse = true;
isFinishedHandlingRequest = true;
} else if (req.method == "Tracing.start") {
// @cdp Tracing.start is implemented as a stub only.
frontendChannel_(cdp::jsonNotification(
// @cdp Tracing.bufferUsage is implemented as a stub only.
"Tracing.bufferUsage",
folly::dynamic::object("percentFull", 0)("eventCount", 0)("value", 0)));
shouldSendOKResponse = true;
isFinishedHandlingRequest = true;
} else if (req.method == "Tracing.end") {
// @cdp Tracing.end is implemented as a stub only.
frontendChannel_(cdp::jsonNotification(
// @cdp Tracing.dataCollected is implemented as a stub only.
"Tracing.dataCollected",
folly::dynamic::object("value", folly::dynamic::array())));
frontendChannel_(cdp::jsonNotification(
// @cdp Tracing.tracingComplete is implemented as a stub only.
"Tracing.tracingComplete",
folly::dynamic::object("dataLossOccurred", false)));
shouldSendOKResponse = true;
isFinishedHandlingRequest = true;
}
if (!isFinishedHandlingRequest && instanceAgent_ &&