Refactor DrawView to avoid extra allocates.

Summary: Previously, the first time we collected a draw view, we would make a clone, even though the draw view had never been mutated.  This refactors draw view to avoid this extra allocate.

Reviewed By: ahmedre

Differential Revision: D3719056
This commit is contained in:
Seth Kirby authored and Ahmed El-Helw committed 2016-12-19 13:40:32 -08:00
1 parent cc216b5ec3
commit b2f41e2921
3 files changed
+70 -42

No files matched your search

@@ -503,7 +503,7 @@ import com.facebook.react.views.view.ReactClippingViewGroupHelper;
float clipRight,
float clipBottom) {
Assertions.assumeNotNull(mDrawView);
if (mDrawView.reactTag == 0) {
if (mDrawView == EMPTY_DRAW_VIEW) {
// This is the first time we have collected this DrawView, but we have to create a new
// DrawView anyway, as reactTag is final, and our DrawView instance is the static copy.
mDrawView = new DrawView(getReactTag());