Skip to content

Improve spec-compliance of Performance interfaces#45525

Closed
rubennorte wants to merge 2 commits into
facebook:mainfrom
rubennorte:export-D59911145
Closed

Improve spec-compliance of Performance interfaces#45525
rubennorte wants to merge 2 commits into
facebook:mainfrom
rubennorte:export-D59911145

Conversation

@rubennorte
Copy link
Copy Markdown
Contributor

Summary:
Changelog: [internal]

This makes several changes to the Performance API to align it closer with the spec:

  • Makes fields of PerformanceEntry and subclasses read-only.
  • Returns instances of the correct subclass of PerformanceEntry to observers.
  • Renames HighResTimeStamp as DOMHighResTimeStamp for alignment with the spec and native

Additionally, I realized that the way we handle performance.measure is a bit problematic at the moment. When we call the function, we create a PerformanceMeasure instance with the data we receive, and return that value. In parallel, we notify the entry to native, which will in turn notify the observers. But the observers will not get those instances we just created, but new instances of PerformanceEntry (not even PerformanceMeasure) with the resolved values. At the same time, the PerformanceMeasure instance we return doesn't resolve its startTime and duration based on the indicated marks (when specified as strings). We need to fix this in the future by resolving the timing data synchronously when calling performance.measure.

Differential Revision: D59911145

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Jul 18, 2024
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D59911145

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D59911145

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D59911145

rubennorte and others added 2 commits July 22, 2024 02:52
Summary:
Pull Request resolved: facebook#45525

Changelog: [internal]

This makes several changes to the Performance API to align it closer with the spec:
* Makes fields of `PerformanceEntry` and subclasses read-only.
* Returns instances of the correct subclass of `PerformanceEntry` to observers.
* Renames `HighResTimeStamp` as `DOMHighResTimeStamp` for alignment with the spec and native

Additionally, I realized that the way we handle `performance.measure` is a bit problematic at the moment. When we call the function, we create a `PerformanceMeasure` instance with the data we receive, and return that value. In parallel, we notify the entry to native, which will in turn notify the observers. But the observers will not get those instances we just created, but new instances of `PerformanceEntry` (not even `PerformanceMeasure`) with the resolved values. At the same time, the `PerformanceMeasure` instance we return doesn't resolve its `startTime` and `duration` based on the indicated marks (when specified as strings). We need to fix this in the future by resolving the timing data synchronously when calling `performance.measure`.

Reviewed By: rshest

Differential Revision: D59911145
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D59911145

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in 2a91a70.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants