mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[perf] Measure exclusive render time
Piece of https://github.com/facebook/react/pull/962
This commit is contained in:
committed by
Paul O’Shannessy
parent
da587b15d5
commit
756bd975b1
@@ -1267,25 +1267,29 @@ var ReactCompositeComponentMixin = {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_renderValidatedComponent: function() {
|
||||
var renderedComponent;
|
||||
var previousContext = ReactContext.current;
|
||||
ReactContext.current = this._processChildContext(this._currentContext);
|
||||
ReactCurrentOwner.current = this;
|
||||
try {
|
||||
renderedComponent = this.render();
|
||||
} finally {
|
||||
ReactContext.current = previousContext;
|
||||
ReactCurrentOwner.current = null;
|
||||
_renderValidatedComponent: ReactPerf.measure(
|
||||
'ReactCompositeComponent',
|
||||
'_renderValidatedComponent',
|
||||
function() {
|
||||
var renderedComponent;
|
||||
var previousContext = ReactContext.current;
|
||||
ReactContext.current = this._processChildContext(this._currentContext);
|
||||
ReactCurrentOwner.current = this;
|
||||
try {
|
||||
renderedComponent = this.render();
|
||||
} finally {
|
||||
ReactContext.current = previousContext;
|
||||
ReactCurrentOwner.current = null;
|
||||
}
|
||||
invariant(
|
||||
ReactComponent.isValidComponent(renderedComponent),
|
||||
'%s.render(): A valid ReactComponent must be returned. You may have ' +
|
||||
'returned null, undefined, an array, or some other invalid object.',
|
||||
this.constructor.displayName || 'ReactCompositeComponent'
|
||||
);
|
||||
return renderedComponent;
|
||||
}
|
||||
invariant(
|
||||
ReactComponent.isValidComponent(renderedComponent),
|
||||
'%s.render(): A valid ReactComponent must be returned. You may have ' +
|
||||
'returned null, undefined, an array, or some other invalid object.',
|
||||
this.constructor.displayName || 'ReactCompositeComponent'
|
||||
);
|
||||
return renderedComponent;
|
||||
},
|
||||
),
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
Reference in New Issue
Block a user