Skip to content

Commit

Permalink
Clean up preallocateMountContent
Browse files Browse the repository at this point in the history
Summary:
Depends on D6081368
There's an unnecessary call to `removeCallbacks` in the chain of events of preallocateMountContent. Due to the implementation, each ComponentTree gets 1 runnable. Those ComponentTrees are reused, so the Runnables are reused. And posting that Runnable into the IdleExecutorHandler will mean the `mRunnablesHashMap` inside the IdleExecutorHandler will keep overwriting the mapping from key to value. The underlying executor may behave differently, but canceling the runnable in the queue will not have the same effect as actually canceling other runnables.

tl;dr this is an unnecessary couple lines of code

`preallocateMountContent` probably needs a rewrite, but for now let's keep it as clean as possible

Reviewed By: mihaelao

Differential Revision: D6081845

fbshipit-source-id: 73199985d1301e13717d16e9e982140ed954d285
  • Loading branch information
jsendros authored and facebook-github-bot committed Oct 18, 2017
1 parent 23de04e commit 85153dd
Showing 1 changed file with 0 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -754,12 +754,6 @@ public void setRoot(Component<?> rootComponent) {
private void preAllocateMountContent() {
final LayoutState toPrePopulate;

// Cancel any scheduled preallocate requests we might have in the background queue
// since we are starting the preallocation.
if (mPreAllocateMountContentHandler != null) {
mPreAllocateMountContentHandler.removeCallbacks(mPreAllocateMountContentRunnable);
}

synchronized (this) {
if (mMainThreadLayoutState != null) {
toPrePopulate = mMainThreadLayoutState;
Expand Down

0 comments on commit 85153dd

Please sign in to comment.