mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-06-17 06:29:17 +08:00
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:
committed by
Facebook Github Bot
parent
e93522b14b
commit
747d1f7029
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ class SchedulerDelegate {
|
||||
*/
|
||||
virtual void schedulerDidRequestPreliminaryViewAllocation(
|
||||
SurfaceId surfaceId,
|
||||
bool isLayoutable,
|
||||
const ShadowView &shadowView) = 0;
|
||||
|
||||
virtual ~SchedulerDelegate() noexcept = default;
|
||||
|
||||
Reference in New Issue
Block a user