mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Revert CommitInfo to avoid extra allocation
I added this when I thought we might support interleaved commits, but we don't.
This commit is contained in:
@@ -67,10 +67,9 @@ type HostContextDev = {
|
||||
};
|
||||
type HostContextProd = string;
|
||||
type HostContext = HostContextDev | HostContextProd;
|
||||
type CommitInfo = {
|
||||
eventsEnabled: boolean,
|
||||
selectionInformation: mixed,
|
||||
};
|
||||
|
||||
let eventsEnabled : ?boolean = null;
|
||||
let selectionInformation : ?mixed = null;
|
||||
|
||||
var ELEMENT_NODE_TYPE = 1;
|
||||
var DOC_NODE_TYPE = 9;
|
||||
@@ -138,18 +137,17 @@ var DOMRenderer = ReactFiberReconciler({
|
||||
return getChildNamespace(parentNamespace, type);
|
||||
},
|
||||
|
||||
prepareForCommit() : CommitInfo {
|
||||
const eventsEnabled = ReactBrowserEventEmitter.isEnabled();
|
||||
prepareForCommit() : void {
|
||||
eventsEnabled = ReactBrowserEventEmitter.isEnabled();
|
||||
selectionInformation = ReactInputSelection.getSelectionInformation();
|
||||
ReactBrowserEventEmitter.setEnabled(false);
|
||||
return {
|
||||
eventsEnabled,
|
||||
selectionInformation: ReactInputSelection.getSelectionInformation(),
|
||||
};
|
||||
},
|
||||
|
||||
resetAfterCommit(commitInfo : CommitInfo) : void {
|
||||
ReactInputSelection.restoreSelection(commitInfo.selectionInformation);
|
||||
ReactBrowserEventEmitter.setEnabled(commitInfo.eventsEnabled);
|
||||
resetAfterCommit() : void {
|
||||
ReactInputSelection.restoreSelection(selectionInformation);
|
||||
selectionInformation = null;
|
||||
ReactBrowserEventEmitter.setEnabled(eventsEnabled);
|
||||
eventsEnabled = null;
|
||||
},
|
||||
|
||||
createInstance(
|
||||
|
||||
@@ -71,8 +71,8 @@ if (__DEV__) {
|
||||
var warnedAboutStatelessRefs = {};
|
||||
}
|
||||
|
||||
module.exports = function<T, P, I, TI, C, CX, CI>(
|
||||
config : HostConfig<T, P, I, TI, C, CX, CI>,
|
||||
module.exports = function<T, P, I, TI, C, CX>(
|
||||
config : HostConfig<T, P, I, TI, C, CX>,
|
||||
hostContext : HostContext<C, CX>,
|
||||
scheduleUpdate : (fiber : Fiber, priorityLevel : PriorityLevel) => void,
|
||||
getPriorityContext : () => PriorityLevel,
|
||||
|
||||
@@ -34,8 +34,8 @@ var {
|
||||
ContentReset,
|
||||
} = require('ReactTypeOfSideEffect');
|
||||
|
||||
module.exports = function<T, P, I, TI, C, CX, CI>(
|
||||
config : HostConfig<T, P, I, TI, C, CX, CI>,
|
||||
module.exports = function<T, P, I, TI, C, CX>(
|
||||
config : HostConfig<T, P, I, TI, C, CX>,
|
||||
hostContext : HostContext<C, CX>,
|
||||
captureError : (failedFiber : Fiber, error: Error) => ?Fiber
|
||||
) {
|
||||
|
||||
@@ -46,8 +46,8 @@ if (__DEV__) {
|
||||
var ReactDebugCurrentFiber = require('ReactDebugCurrentFiber');
|
||||
}
|
||||
|
||||
module.exports = function<T, P, I, TI, C, CX, CI>(
|
||||
config : HostConfig<T, P, I, TI, C, CX, CI>,
|
||||
module.exports = function<T, P, I, TI, C, CX>(
|
||||
config : HostConfig<T, P, I, TI, C, CX>,
|
||||
hostContext : HostContext<C, CX>,
|
||||
) {
|
||||
const {
|
||||
|
||||
@@ -34,8 +34,8 @@ export type HostContext<C, CX> = {
|
||||
resetHostContainer() : void,
|
||||
};
|
||||
|
||||
module.exports = function<T, P, I, TI, C, CX, CI>(
|
||||
config : HostConfig<T, P, I, TI, C, CX, CI>
|
||||
module.exports = function<T, P, I, TI, C, CX>(
|
||||
config : HostConfig<T, P, I, TI, C, CX>
|
||||
) : HostContext<C, CX> {
|
||||
const {
|
||||
getChildHostContext,
|
||||
|
||||
@@ -43,7 +43,7 @@ export type Deadline = {
|
||||
|
||||
type OpaqueNode = Fiber;
|
||||
|
||||
export type HostConfig<T, P, I, TI, C, CX, CI> = {
|
||||
export type HostConfig<T, P, I, TI, C, CX> = {
|
||||
|
||||
getRootHostContext(rootContainerInstance : C) : CX,
|
||||
getChildHostContext(parentHostContext : CX, type : T) : CX,
|
||||
@@ -69,8 +69,8 @@ export type HostConfig<T, P, I, TI, C, CX, CI> = {
|
||||
scheduleAnimationCallback(callback : () => void) : void,
|
||||
scheduleDeferredCallback(callback : (deadline : Deadline) => void) : void,
|
||||
|
||||
prepareForCommit() : CI,
|
||||
resetAfterCommit(commitInfo : CI) : void,
|
||||
prepareForCommit() : void,
|
||||
resetAfterCommit() : void,
|
||||
|
||||
useSyncScheduling ?: boolean,
|
||||
};
|
||||
@@ -101,7 +101,7 @@ getContextForSubtree._injectFiber(function(fiber : Fiber) {
|
||||
parentContext;
|
||||
});
|
||||
|
||||
module.exports = function<T, P, I, TI, C, CX, CI>(config : HostConfig<T, P, I, TI, C, CX, CI>) : Reconciler<C, I, TI> {
|
||||
module.exports = function<T, P, I, TI, C, CX>(config : HostConfig<T, P, I, TI, C, CX>) : Reconciler<C, I, TI> {
|
||||
|
||||
var {
|
||||
scheduleUpdate,
|
||||
|
||||
@@ -74,7 +74,7 @@ if (__DEV__) {
|
||||
|
||||
var timeHeuristicForUnitOfWork = 1;
|
||||
|
||||
module.exports = function<T, P, I, TI, C, CX, CI>(config : HostConfig<T, P, I, TI, C, CX, CI>) {
|
||||
module.exports = function<T, P, I, TI, C, CX>(config : HostConfig<T, P, I, TI, C, CX>) {
|
||||
const hostContext = ReactFiberHostContext(config);
|
||||
const { popHostContainer, popHostContext, resetHostContainer } = hostContext;
|
||||
const { beginWork, beginFailedWork } = ReactFiberBeginWork(
|
||||
|
||||
Reference in New Issue
Block a user