react-native/Libraries
Spencer Ahrens 893a54d0cd Add yieldy, chained async task support to InteractionManager
Summary:
Default behavior should be unchanged.

If we queue up a bunch of expensive tasks during an interaction, the default
`InteractionManager` behavior would execute them all in one synchronous loop at
the end the JS event loop via one `setImmediate` call, blocking the JS thread
the entire time.

The `setDeadline` addition in this diff enables an option to only execute tasks
until the `eventLoopRunningTime` is hit (added to MessageQueue/BatchedBridge),
allowing the queue execution to be paused if an interaction starts in between
tasks, making the app more responsive.

Additionally, if a task ends up generating a bunch of additional tasks
asynchronously, the previous implementation would execute these new tasks after
already scheduled tasks. This is often fine, but I want it to fully resolve
async tasks and all their dependencies before making progress in the rest of the
queue, so I added support for `type PromiseTask = {gen: () => Promise}` to do
just this. It works by building a stack of queues each time a `PromiseTask` is
started, and pops them off the stack once they are resolved and the queues are
processed.

I also pulled all of the actual queue logic out of `InteractionManager` and into
a new `TaskQueue` class to isolate concerns a bit.

public

Reviewed By: josephsavona

Differential Revision: D2754311

fb-gh-sync-id: bfd6d0c54e6410cb261aa1d2c5024dd91a3959e6
2015-12-23 16:12:30 -08:00
..
ART Mark `-[init]` w RCT_NOT_IMPLEMENTED 2015-11-14 06:29:27 -08:00
ActionSheetIOS Add tintColor for buttons. 2015-12-09 05:19:25 -08:00
AdSupport Text highlighting on iOS 2015-07-24 08:41:58 -08:00
Animated updated deprecated sample code in animation doc 2015-12-18 00:11:00 +08:00
AppRegistry Decouple Module System from Native Calls 2015-12-08 16:03:37 -08:00
AppStateIOS revert D2372548 to fix initial app state issue 2015-09-25 13:25:26 -07:00
BatchedBridge Rename BridgeProfiling to Systrace for consistency 2015-12-11 03:53:19 -08:00
CameraRoll Bugfix - Typos 2015-12-15 09:09:32 -08:00
Components Added ColorPropType 2015-12-23 10:08:38 -08:00
CustomComponents fix listview inefficiency for tail-fetching scenarios (part1) 2015-12-21 08:41:31 -08:00
DebugComponentHierarchy Decouple Module System from Native Calls 2015-12-08 16:03:37 -08:00
Device Decouple Module System from Native Calls 2015-12-08 16:03:37 -08:00
Devtools Use pre-bundled elements inspector 2015-10-29 11:21:32 -07:00
Fetch Add fetch's clone function to Request and Response prototypes 2015-10-30 10:57:33 -07:00
Geolocation Fix getCurrentPosition 2015-12-16 08:37:33 -08:00
Image Added ColorPropType 2015-12-23 10:08:38 -08:00
Inspector Inspecting stateless components. 2015-12-08 10:13:25 -08:00
Interaction Add yieldy, chained async task support to InteractionManager 2015-12-23 16:12:30 -08:00
JavaScriptAppEngine Inline require ExceptionsManager dependencies 2015-12-16 04:02:30 -08:00
LayoutAnimation Wrapped UIManager native module for better abstraction 2015-11-27 07:00:32 -08:00
LinkingIOS Add support for Universal Links 2015-12-04 09:05:31 -08:00
Modal Improve Modal docs describing iOS only support 2015-12-05 18:48:28 -08:00
NativeApp Decouple Module System from Native Calls 2015-12-08 16:03:37 -08:00
Network Deploy v0.20.1 2015-12-18 17:04:29 -08:00
Picker Added support for styling the PickerIOS 2015-12-08 07:48:26 -08:00
Portal Wrapped UIManager native module for better abstraction 2015-11-27 07:00:32 -08:00
PullToRefresh Added ColorPropType 2015-12-23 10:08:38 -08:00
PushNotificationIOS Bugfix - Typos 2015-12-15 09:09:32 -08:00
QuickPerformanceLogger added QPL for main interactions 2015-09-29 22:25:23 -07:00
RCTTest Rename RCTContextExecutor to RCTJSCExecutor 2015-12-16 02:51:28 -08:00
RKBackendNode Wrapped UIManager native module for better abstraction 2015-11-27 07:00:32 -08:00
ReactIOS Fix scroll-to-top in MarketPlace 2015-12-23 12:40:33 -08:00
ReactNative Deploy v0.20.1 2015-12-18 17:04:29 -08:00
Sample
Settings Replaced RegExp method parser with recursive descent 2015-12-10 10:12:29 -08:00
Storage Batch AsyncStorage.multiGet calls 2015-12-03 09:10:29 -08:00
StyleSheet Added ColorPropType 2015-12-23 10:08:38 -08:00
Text Added ColorPropType 2015-12-23 10:08:38 -08:00
Utilities Add yieldy, chained async task support to InteractionManager 2015-12-23 16:12:30 -08:00
Vibration Text highlighting on iOS 2015-07-24 08:41:58 -08:00
WebSocket Improve red boxes coming from RCTWebSocketExecutor 2015-12-23 13:32:28 -08:00
react-native Added ColorPropType 2015-12-23 10:08:38 -08:00
vendor add doc for native event in doc 2015-12-20 16:20:56 +08:00
Promise.js