Cleanup SchedulerDelegate interface

Summary: This diff removes the "isLayoutable" parameter from SchedulerDelegate.schedulerDidRequestPreliminaryViewAllocation. This now can be infered from the shadowView parameter

Reviewed By: shergin

Differential Revision: D14296481

fbshipit-source-id: b200504f9c2bef41f0a70257f1f5a274fbe97cbb
This commit is contained in:
David Vacca
2019-03-03 15:47:07 -08:00
committed by Facebook Github Bot
parent e93522b14b
commit 747d1f7029
5 changed files with 7 additions and 14 deletions

View File

@@ -33,12 +33,10 @@ class SchedulerDelegateProxy : public SchedulerDelegate {
[scheduler.delegate schedulerDidFinishTransaction:mutations rootTag:rootTag];
}
void schedulerDidRequestPreliminaryViewAllocation(
SurfaceId surfaceId,
bool isLayoutable,
const ShadowView &shadowView) override
void schedulerDidRequestPreliminaryViewAllocation(SurfaceId surfaceId, const ShadowView &shadowView) override
{
if (!isLayoutable) {
bool isLayoutableShadowNode = shadowView.layoutMetrics != EmptyLayoutMetrics;
if (!isLayoutableShadowNode) {
return;
}

View File

@@ -467,10 +467,11 @@ void Binding::setPixelDensity(float pointScaleFactor) {
void Binding::schedulerDidRequestPreliminaryViewAllocation(
const SurfaceId surfaceId,
bool isLayoutable,
const ShadowView &shadowView) {
if (isLayoutable) {
bool isLayoutableShadowNode = shadowView.layoutMetrics != EmptyLayoutMetrics;
if (isLayoutableShadowNode) {
static auto preallocateView =
jni::findClassStatic(UIManagerJavaDescriptor)
->getMethod<void(jint, jint, jstring, ReadableMap::javaobject)>("preallocateView");

View File

@@ -64,7 +64,6 @@ class Binding : public jni::HybridClass<Binding>, public SchedulerDelegate {
void schedulerDidRequestPreliminaryViewAllocation(
const SurfaceId surfaceId,
bool isLayoutable,
const ShadowView &shadowView);
void setPixelDensity(float pointScaleFactor);

View File

@@ -258,13 +258,9 @@ void Scheduler::uiManagerDidCreateShadowNode(
SystraceSection s("Scheduler::uiManagerDidCreateShadowNode");
if (delegate_) {
auto layoutableShadowNode =
dynamic_cast<const LayoutableShadowNode *>(shadowNode.get());
auto isLayoutable = layoutableShadowNode != nullptr;
auto shadowView = ShadowView(*shadowNode);
delegate_->schedulerDidRequestPreliminaryViewAllocation(
shadowNode->getRootTag(), isLayoutable, shadowView);
shadowNode->getRootTag(), shadowView);
}
}

View File

@@ -35,7 +35,6 @@ class SchedulerDelegate {
*/
virtual void schedulerDidRequestPreliminaryViewAllocation(
SurfaceId surfaceId,
bool isLayoutable,
const ShadowView &shadowView) = 0;
virtual ~SchedulerDelegate() noexcept = default;