Make MountReady more reusable, reduce allocations

Test Plan:
grunt test
This commit is contained in:
Ben Alpert
2014-04-06 17:06:12 -07:00
parent 21de5c816f
commit ec6da04f6a
4 changed files with 44 additions and 38 deletions
+5 -6
View File
@@ -19,10 +19,10 @@
"use strict";
var CallbackQueue = require('CallbackQueue');
var PooledClass = require('PooledClass');
var ReactEventEmitter = require('ReactEventEmitter');
var ReactInputSelection = require('ReactInputSelection');
var ReactMountReady = require('ReactMountReady');
var ReactPutListenerQueue = require('ReactPutListenerQueue');
var Transaction = require('Transaction');
@@ -69,8 +69,8 @@ var EVENT_SUPPRESSION = {
};
/**
* Provides a `ReactMountReady` queue for collecting `onDOMReady` callbacks
* during the performing of the transaction.
* Provides a queue for collecting `componentDidMount` and
* `componentDidUpdate` callbacks during the the transaction.
*/
var ON_DOM_READY_QUEUEING = {
/**
@@ -132,7 +132,7 @@ function ReactReconcileTransaction() {
// accessible and defaults to false when `ReactDOMComponent` and
// `ReactTextComponent` checks it in `mountComponent`.`
this.renderToStaticMarkup = false;
this.reactMountReady = ReactMountReady.getPooled(null);
this.reactMountReady = CallbackQueue.getPooled(null);
this.putListenerQueue = ReactPutListenerQueue.getPooled();
}
@@ -150,7 +150,6 @@ var Mixin = {
/**
* @return {object} The queue to collect `onDOMReady` callbacks with.
* TODO: convert to ReactMountReady
*/
getReactMountReady: function() {
return this.reactMountReady;
@@ -165,7 +164,7 @@ var Mixin = {
* instance to be resused.
*/
destructor: function() {
ReactMountReady.release(this.reactMountReady);
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
ReactPutListenerQueue.release(this.putListenerQueue);
@@ -20,7 +20,7 @@
"use strict";
var PooledClass = require('PooledClass');
var ReactMountReady = require('ReactMountReady');
var CallbackQueue = require('CallbackQueue');
var ReactPutListenerQueue = require('ReactPutListenerQueue');
var Transaction = require('Transaction');
@@ -28,7 +28,7 @@ var emptyFunction = require('emptyFunction');
var mixInto = require('mixInto');
/**
* Provides a `ReactMountReady` queue for collecting `onDOMReady` callbacks
* Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
* during the performing of the transaction.
*/
var ON_DOM_READY_QUEUEING = {
@@ -67,7 +67,7 @@ var TRANSACTION_WRAPPERS = [
function ReactServerRenderingTransaction(renderToStaticMarkup) {
this.reinitializeTransaction();
this.renderToStaticMarkup = renderToStaticMarkup;
this.reactMountReady = ReactMountReady.getPooled(null);
this.reactMountReady = CallbackQueue.getPooled(null);
this.putListenerQueue = ReactPutListenerQueue.getPooled();
}
@@ -84,7 +84,6 @@ var Mixin = {
/**
* @return {object} The queue to collect `onDOMReady` callbacks with.
* TODO: convert to ReactMountReady
*/
getReactMountReady: function() {
return this.reactMountReady;
@@ -99,7 +98,7 @@ var Mixin = {
* instance to be resused.
*/
destructor: function() {
ReactMountReady.release(this.reactMountReady);
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
ReactPutListenerQueue.release(this.putListenerQueue);