Граф коммитов

34 Коммитов

Автор SHA1 Сообщение Дата
Micha Reiser 93377ff508 Remove "use strict" directive from ES Modules
Summary:
ES Modules implicitly enable strict mode. Adding the "use strict" directive is, therefore, not required.

This diff removes all "use strict" directives from ES modules.

Changelog:

[Internal]

Reviewed By: motiz88

Differential Revision: D26172715

fbshipit-source-id: 57957bcbb672c4c3e62b1db633cf425c1c9d6430
2021-02-02 11:12:56 -08:00
Rubén Norte 74fc285c58 Allow specifying custom timestamps in performance logger spans
Summary: Changelog: [internal] Allow specifying custom timestamps in {start/stop}Timestamp in performance loggers

Reviewed By: lunaleaps

Differential Revision: D24474631

fbshipit-source-id: 48d8e69af8ba79ef1638cd5d03bac33af84f7881
2020-10-23 07:14:59 -07:00
Rubén Norte 5c498e3d6b Migrate createPerformanceLogger to ESM and export getCurrentTimestamp
Summary: Changelog: [internal]

Reviewed By: lunaleaps

Differential Revision: D24476172

fbshipit-source-id: 5afa58935a6a3a8e1d2d0d0bb8b3b28840fc17f4
2020-10-23 07:14:59 -07:00
Luna Wei f9dec99284 Introduce multi-flush logger
Summary:
Changelog:
[Internal][Changed] - export types of performance logger

Reviewed By: rubennorte

Differential Revision: D24099293

fbshipit-source-id: 023459baa3754fb8bfaf6bf7a9061873af5756f9
2020-10-10 02:06:06 -07:00
Luna Wei 88174991d9 Close globalLogger when creating scopedLogger
Summary:
# Changelog:
[Internal][Changed] - Close the global perf logger when we create the scoped performance logger and absorb the global perf logger into the scoped logger

Reviewed By: rubennorte

Differential Revision: D23898621

fbshipit-source-id: 0d9bfd95175e660c0bd0bc74974126f92fe409b2
2020-10-06 12:31:31 -07:00
Luna Wei b85b4f46af Update PerformanceLogger to nullable timespans, points, extras
Summary: Changelog: [Internal][Fixed] - When we close performance loggers (D23845307 (aebb97b9c6)) we cannot rely that a timespan/point/extra will be in perf logger. Update types to reflect that.

Reviewed By: rubennorte

Differential Revision: D23907741

fbshipit-source-id: 63673aa69cd8c76253e4fee3463e37c86265cf7b
2020-09-28 10:53:55 -07:00
Luna Wei aebb97b9c6 Add close() to IPerformanceLogger
Summary:
To represent a final state where a logger should no longer be used

Changelog: [Internal] - To represent a final state where a logger should no longer be used

Reviewed By: rubennorte

Differential Revision: D23845307

fbshipit-source-id: 4b2bfda4f7425ba6bc8e5e1233d9baea60dd8667
2020-09-23 15:49:38 -07:00
Luna Wei 6d355c0abd Sort logger alphabetically
Summary:
Rearranging to alphabetically sort, no functionality changes

Changelog: [Internal]

Reviewed By: rubennorte, motiz88

Differential Revision: D23836997

fbshipit-source-id: 00232b88379e44920ecb74fa6ff43f36d941d93b
2020-09-23 15:49:38 -07:00
Andrei Shikov 22b5f32f74 Add extras to timespan and points in performance logger
Summary:
Changelog:
[Internal][Added] Added point-level extras to performance logger

Reviewed By: lunaleaps, rubennorte

Differential Revision: D23730275

fbshipit-source-id: 285c5d7ac769bd109df7ce0294da024401edf7d3
2020-09-21 07:37:40 -07:00
Rubén Norte f1b84ddf2c Remove update option from stopTimestamp method in performance loggers
Summary:
Changelog:
[Internal][Changed] Removed `update` option from `stopTimestamp` method in performance loggers

Reviewed By: lunaleaps

Differential Revision: D23759138

fbshipit-source-id: bb83b6f5ff2f640733c2e508779b3bc52800e4f6
2020-09-18 07:14:17 -07:00
Rubén Norte fc4f667cde Remove unnecessary addTimeAnnotation method from performance logger
Summary:
Changelog:
[Internal][Removed] Removed `addTimeAnnotation` method from performance loggers

Reviewed By: lunaleaps

Differential Revision: D23758816

fbshipit-source-id: 98e0abae25266f3dcc5953f25f20cde8e3dac190
2020-09-18 07:14:16 -07:00
Rubén Norte 4d842963fa Remove unused timespan descriptions from performance loggers
Summary:
The `description` parameter is never used so we can simplify the API.

Changelog:
[Internal][Changed] Removed `description` option from performance logger timespans

Reviewed By: lunaleaps

Differential Revision: D23758829

fbshipit-source-id: 10900f86effc3e1f54a408cf8f9fbc9b3b52f569
2020-09-18 07:14:16 -07:00
Rubén Norte 2788ee8ba9 Improve performance logger definition and type safety
Summary:
The way the performance logger is defined now is very unsafe regarding type safety, as all accesses to its properties is untyped (`any`) and it uses several `mixed` types in cases that could be more refined.

This migrates the creation of performance loggers to instances of a class to improve its type safety. If there's an impact in performance, it's expected to be positive.

Changelog:
[Internal][Changed] - Replaced object literals with class instances to create performance loggers

Reviewed By: lunaleaps

Differential Revision: D23758609

fbshipit-source-id: 0734742eb97d92a4a53f7b66a8ca45a2ae90946c
2020-09-18 07:14:16 -07:00
Rubén Norte b90f4d978f Refactor IPerformanceLogger as an interface
Summary:
This type makes more sense as an interface, given a class would be a common implementation (and object types aren't supported in that case).

It also adds the names of the parameters so it's easier to understand for implementers.

Changelog:
[General][Changed] - Changed type definition of IPerformanceLogger from object to interface

Reviewed By: lunaleaps

Differential Revision: D23449816

fbshipit-source-id: be872748827b123587f3f397da20f5545b0aae07
2020-09-03 06:46:09 -07:00
Luna Wei e3845f44ea Clean up unused methods of IPerformanceLogger
Summary:
Changelog:
[Internal][Removed] - Remove unused performance logger methods and merged all the logs to `logEverything`

Reviewed By: cpojer

Differential Revision: D23284721

fbshipit-source-id: 91f948302bb36bb45ceb3c9510392029faa59605
2020-08-27 01:09:26 -07:00
Luna Wei affac5ab30 Fix addTimespanAnnotations
Summary:
Changelog:
[Internal][Fixed] - Fix call for addTimespanAnnotations to call addTimespanAnnotation.

I'm not sure why Flow didn't catch this?

Reviewed By: motiz88

Differential Revision: D23284722

fbshipit-source-id: 054446f5e1bd9881eddb0c0252797142026717ef
2020-08-27 01:09:25 -07:00
Andrey Tserkus db474a47b7 RN: Fixed `performanceNow()` to allow debugging in Chrome
Summary:
Discovered when debugging a React Native app in Chrome. The function `performanceNow` was recently changed, so that in Chrome it now refers to `performance.now()` method. However, `now()` cannot be called standalone without a context.

Reproduced by a synthetic example in Chrome:
```
const performanceNow = window.performance.now;
performanceNow();

Uncaught TypeError: Illegal invocation
    at <anonymous>:1:1
```

Changelog:
[General] [Fixed] - Fix failure when debugging code in a browser; was caused by `performanceNow()` function.

Reviewed By: cpojer

Differential Revision: D22739176

fbshipit-source-id: f89b8a215b7b4c430ffd72a1d23539c4f1b31d24
2020-07-28 17:20:54 -07:00
Luna Wei 509e9dbd5f Change signature for addTimestamp for performance logger
Summary:
Changelog:
[Internal][Added] - Change signature of `addTimestamp` for IPerformanceLogger and rename old implementation to addTimeAnnotation

Adding this because there is no current ability to add a timespan to our perf logging with pre-defined start and end timestamps. The naming is a bit confusing because the current implementation of `addTimespan` in FB doesn't add a timespan, it adds an annotation of duration. We rename the old implementation to `addTimeAnnotation/s` and update `addTimespan` to suit our needs.

Reviewed By: rubennorte

Differential Revision: D22633202

fbshipit-source-id: 0e32099241f1f3835257cbb4ad108a4f437869e6
2020-07-27 14:28:56 -07:00
Rubén Norte 4409642811 Migrate large amount of modules to flow strict and strict-local
Summary:
| Group | Before | After | Change |
| Untyped | 50 | 49 | -1 |
| flow | 197 | 155 | -42 |
| flow strict-local | 226 | 185 | -41 |
| flow strict | 33 | 117 | +84

Changelog: [Changed] Improved Flow typing of multiple modules (with migrations to `flow strict` and `flow strict-local`

Reviewed By: motiz88

Differential Revision: D22549140

fbshipit-source-id: ed29415332cfce15b244ee4dea9e13d035543175
2020-07-22 09:46:16 -07:00
Tim Yung caf010914c RN: Remove `fbjs/performanceNow` Dependency
Summary:
Replaces `fbjs/performanceNow` call sites in React Native with `performance.now`.

We did not originally polyfill this in `InitializeCore`, but now we do (and back it with a proper `nativePerformanceNow` implementation). Also, added the missing polyfill to our Jest setup.

Changelog:
[Internal]

Reviewed By: cpojer

Differential Revision: D22445948

fbshipit-source-id: dcfd9867c050617f6e2a3d0a1eb6f48a44771dda
2020-07-09 11:40:57 -07:00
Michael Bolin 0b9ea60b4f Back out "Upgrade Prettier from 1.17 to 2.0.2."
Differential Revision: D20639755

fbshipit-source-id: 5028563f9cf0527a30b4259daac50cdc03934bfd
2020-03-24 21:47:35 -07:00
Michael Bolin cf44650b3f Upgrade Prettier from 1.17 to 2.0.2.
Summary:
This gets us on the latest Prettier 2.x:
https://prettier.io/blog/2020/03/21/2.0.0.html

Notably, this adds support for TypeScript 3.8,
which introduces new syntax, such as `import type`.

Reviewed By: zertosh

Differential Revision: D20636268

fbshipit-source-id: fca5833d003804333a05ba16325bbbe0e06d6c8a
2020-03-24 20:24:47 -07:00
Spencer Ahrens 08c338eebf update JSTime to last call
Summary: ChangeLog: [General] [Added] - support PerformanceLogger stopTimespan updates

Reviewed By: alexeylang

Differential Revision: D20095949

fbshipit-source-id: 3522a8d16ced44d6b699b294004371e223f9f619
2020-03-09 19:47:36 -07:00
George Zahariev 8553e1acc4 Exact-by-default codemod for react-native-github
Summary:
We are rolling out exact-by-default syntax to xplat/js.

I had to manually move around some comments to preserve proper placement.

Changelog: [Internal]

Reviewed By: jbrown215

Differential Revision: D18633611

fbshipit-source-id: 48f7468dcc55b1d00985419d035a61c6820b3abe
2019-11-21 09:42:57 -08:00
Andres Suarez 3b31e69e28 Tidy up license headers [2/n]
Summary: Changelog: [General] [Fixed] - License header cleanup

Reviewed By: yungsters

Differential Revision: D17952694

fbshipit-source-id: 17c87de7ebb271fa2ac8d00af72a4d1addef8bd0
2019-10-16 10:06:34 -07:00
Min ho Kim 84f5ebe4f9 Fix typos (#25770)
Summary:
Fix typos mostly in comments and some string literals.

## Changelog

[General] [Fixed] - Fix typos
Pull Request resolved: https://github.com/facebook/react-native/pull/25770

Differential Revision: D16437857

Pulled By: cpojer

fbshipit-source-id: ffeb4d6b175e341381352091134f7c97d78c679f
2019-07-23 03:23:11 -07:00
Christoph Nakazawa 1c5944be16 Disable logging from performance logger unless it is enabled
Summary: D16107933 disabled the logs around setup unless they are explicitly enabled and this diff disables all logs from this module entirely unless they are explicitly turned on at the top of the file.

Reviewed By: gaearon

Differential Revision: D16108151

fbshipit-source-id: 355aaf8624fb0778884f25f02d58fe4e1237d686
2019-07-04 02:54:46 -07:00
Christoph Nakazawa c31fa2a45d Do not show setup logs from `createPerformanceLogger` unless logs are enabled for it
Summary: This module logs helpful messages in `__DEV__` but it only logs actionable performance logs when the flag on top of the file is enabled. This diff changes those to only log when the toggle on top of the file is enabled as well.

Reviewed By: gaearon

Differential Revision: D16107933

fbshipit-source-id: 7671bc521af984d617a0f5ffc0eacd1aa5674a62
2019-07-04 02:54:45 -07:00
James Ide 0ee5f68929 Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749)
Summary:
This is the next step in moving RN towards standard path-based requires. All the requires in `Libraries` have been rewritten to use relative requires with a few exceptions, namely, `vendor` and `Renderer/oss` since those need to be changed upstream. This commit uses relative requires instead of `react-native/...` so that if Facebook were to stop syncing out certain folders and therefore remove code from the react-native package, internal code at Facebook would not need to change.

See the umbrella issue at https://github.com/facebook/react-native/issues/24316 for more detail.

[General] [Changed] - Migrate "Libraries" from Haste to standard path-based requires
Pull Request resolved: https://github.com/facebook/react-native/pull/24749

Differential Revision: D15258017

Pulled By: cpojer

fbshipit-source-id: a1f480ea36c05c659b6f37c8f02f6f9216d5a323
2019-05-08 08:48:59 -07:00
Alexey Lang c3475419a9 Add removeExtra()
Reviewed By: bestander

Differential Revision: D14386282

fbshipit-source-id: 045dd0f12cc462da694d20da52f3a591b538dc57
2019-03-19 10:24:52 -07:00
Alexey Lang 03841cf08c Migrate PerformanceLoggerFlag to scoped performance logger
Reviewed By: xyin96

Differential Revision: D14385136

fbshipit-source-id: beaf060866ed5b7dee80e18fcd432e7701cff5d3
2019-03-14 06:49:47 -07:00
Alexander Zhang efd28bdc84 Revert D14186694: [RN] Use global or scoped performance loggers everywhere
Differential Revision:
D14186694

Original commit changeset: 062c76eea8fc

fbshipit-source-id: 6d99b94d21da6df4375e342fdecceeebf05959d5
2019-03-07 13:12:12 -08:00
Alexey Lang a9b3ca7fa7 Use global or scoped performance loggers everywhere
Summary:
I'm changing all callsites to use either global or scoped perf logger explicitly in one diff.
`GlobalPerformanceLogger` is basically a singleton
`scopedPerformanceLogger` is scoped to the React tree by using a React Context

Reviewed By: sahrens

Differential Revision: D14186694

fbshipit-source-id: 062c76eea8fce9d9b531f0eddf153bb79d52f68d
2019-03-06 09:51:56 -08:00
Alexey Lang 1aabbf5dce Allow to create local performance loggers
Reviewed By: bestander

Differential Revision: D14159631

fbshipit-source-id: 62830f67060e575841cbc864dde30c7bee7e7c4c
2019-02-28 03:39:40 -08:00