Skip to content

Commit 3aea056

Browse files
rshestfacebook-github-bot
authored andcommitted
Remove "first-input" event type from Event Timing API logging implementation (#35771)
Summary: Pull Request resolved: #35771 [Changelog][Internal] Based on the internal discussion, we don't want to report `first-input` event types for RN (just use plain `event` instead), in the way that [Event Timing API standard suggests](https://www.w3.org/TR/event-timing), as this is doesn't have that clear semantics in the context of RN, also to keep it simpler. Reviewed By: rubennorte Differential Revision: D42341923 fbshipit-source-id: eff2487dee17ef082604e4c807b4d41485328114
1 parent 805b88c commit 3aea056

7 files changed

+7
-35
lines changed

Libraries/WebPerformance/NativePerformanceObserver.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ static PerformanceEntryType stringToPerformanceEntryType(
1818
return PerformanceEntryType::MEASURE;
1919
} else if (entryType == "event") {
2020
return PerformanceEntryType::EVENT;
21-
} else if (entryType == "first-input") {
22-
return PerformanceEntryType::FIRST_INPUT;
2321
} else {
2422
return PerformanceEntryType::UNDEFINED;
2523
}

Libraries/WebPerformance/NativePerformanceObserver.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export const RawPerformanceEntryTypeValues = {
1717
MARK: 1,
1818
MEASURE: 2,
1919
EVENT: 3,
20-
FIRST_INPUT: 4,
2120
};
2221

2322
export type RawPerformanceEntryType = number;

Libraries/WebPerformance/PerformanceEntry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010

1111
export type HighResTimeStamp = number;
12-
export type PerformanceEntryType = 'mark' | 'measure' | 'event' | 'first-input';
12+
export type PerformanceEntryType = 'mark' | 'measure' | 'event';
1313

1414
export class PerformanceEntry {
1515
name: string;

Libraries/WebPerformance/PerformanceEntryReporter.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,12 @@ void PerformanceEntryReporter::event(
170170
const std::string &name,
171171
double startTime,
172172
double duration,
173-
bool isFirstInput,
174173
double processingStart,
175174
double processingEnd,
176175
uint32_t interactionId) {
177176
logEntry(
178177
{name,
179-
static_cast<int>(
180-
isFirstInput ? PerformanceEntryType::FIRST_INPUT
181-
: PerformanceEntryType::EVENT),
178+
static_cast<int>(PerformanceEntryType::EVENT),
182179
startTime,
183180
duration,
184181
processingStart,
@@ -267,12 +264,10 @@ void PerformanceEntryReporter::onEventEnd(EventTag tag) {
267264
// TODO: Define the way to assign interaction IDs to the event chains
268265
// (T141358175)
269266
const uint32_t interactionId = 0;
270-
bool firstInput = isFirstInput(name);
271267
event(
272268
std::move(name),
273269
entry.startTime,
274270
timeStamp - entry.startTime,
275-
firstInput,
276271
entry.dispatchTime,
277272
timeStamp,
278273
interactionId);

Libraries/WebPerformance/PerformanceEntryReporter.h

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ enum class PerformanceEntryType {
4949
MARK = 1,
5050
MEASURE = 2,
5151
EVENT = 3,
52-
FIRST_INPUT = 4,
53-
_COUNT = 5,
52+
_COUNT = 4,
5453
};
5554

5655
class PerformanceEntryReporter : public EventLogger {
@@ -95,7 +94,6 @@ class PerformanceEntryReporter : public EventLogger {
9594
const std::string &name,
9695
double startTime,
9796
double duration,
98-
bool isFirstInput,
9997
double processingStart,
10098
double processingEnd,
10199
uint32_t interactionId);
@@ -112,16 +110,7 @@ class PerformanceEntryReporter : public EventLogger {
112110
void scheduleFlushBuffer();
113111

114112
bool isReportingEvents() const {
115-
return isReportingType(PerformanceEntryType::EVENT) ||
116-
isReportingType(PerformanceEntryType::FIRST_INPUT);
117-
}
118-
119-
bool isFirstInput(std::string name) {
120-
if (firstInputs_.find(name) == firstInputs_.end()) {
121-
firstInputs_.insert(std::move(name));
122-
return true;
123-
}
124-
return false;
113+
return isReportingType(PerformanceEntryType::EVENT);
125114
}
126115

127116
std::optional<AsyncCallback<>> callback_;
@@ -147,7 +136,6 @@ class PerformanceEntryReporter : public EventLogger {
147136
// so a hash map should be just fine.
148137
std::unordered_map<EventTag, EventEntry> eventsInFlight_;
149138
std::mutex eventsInFlightMutex_;
150-
std::unordered_set<std::string> firstInputs_;
151139

152140
static EventTag sCurrentEventTag_;
153141
};

Libraries/WebPerformance/PerformanceEventTiming.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ export class PerformanceEventTiming extends PerformanceEntry {
2424
processingStart?: HighResTimeStamp,
2525
processingEnd?: HighResTimeStamp,
2626
interactionId?: number,
27-
isFirstInput?: boolean,
2827
}) {
2928
super({
3029
name: init.name,
31-
entryType: init.isFirstInput === true ? 'first-input' : 'event',
30+
entryType: 'event',
3231
startTime: init.startTime ?? 0,
3332
duration: init.duration ?? 0,
3433
});

Libraries/WebPerformance/PerformanceObserver.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ function rawToPerformanceEntryType(
3131
return 'measure';
3232
case RawPerformanceEntryTypeValues.EVENT:
3333
return 'event';
34-
case RawPerformanceEntryTypeValues.FIRST_INPUT:
35-
return 'first-input';
3634
default:
3735
throw new TypeError(
3836
`unexpected performance entry type received: ${type}`,
@@ -41,19 +39,14 @@ function rawToPerformanceEntryType(
4139
}
4240

4341
function rawToPerformanceEntry(entry: RawPerformanceEntry): PerformanceEntry {
44-
if (
45-
entry.entryType === RawPerformanceEntryTypeValues.EVENT ||
46-
entry.entryType === RawPerformanceEntryTypeValues.FIRST_INPUT
47-
) {
42+
if (entry.entryType === RawPerformanceEntryTypeValues.EVENT) {
4843
return new PerformanceEventTiming({
4944
name: entry.name,
5045
startTime: entry.startTime,
5146
duration: entry.duration,
5247
processingStart: entry.processingStart,
5348
processingEnd: entry.processingEnd,
5449
interactionId: entry.interactionId,
55-
isFirstInput:
56-
entry.entryType === RawPerformanceEntryTypeValues.FIRST_INPUT,
5750
});
5851
} else {
5952
return new PerformanceEntry({
@@ -298,7 +291,7 @@ export default class PerformanceObserver {
298291
}
299292

300293
static supportedEntryTypes: $ReadOnlyArray<PerformanceEntryType> =
301-
Object.freeze(['mark', 'measure', 'event', 'first-input']);
294+
Object.freeze(['mark', 'measure', 'event']);
302295
}
303296

304297
function union<T>(a: $ReadOnlySet<T>, b: $ReadOnlySet<T>): Set<T> {

0 commit comments

Comments
 (0)