aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Lange <lange.fabian@gmail.com>2015-03-02 13:08:02 +0100
committerFabian Lange <lange.fabian@gmail.com>2015-03-11 09:57:21 +0100
commited8ac01fbd34d4ef8654bc458b83773898aa55b4 (patch)
tree83f797f6a361b18851d595e951fca08f056f9fc2
parentc2a85b37901a70fa3134c0dc2adfcff97e7b06e8 (diff)
downloadvaadin-framework-ed8ac01fbd34d4ef8654bc458b83773898aa55b4.tar.gz
vaadin-framework-ed8ac01fbd34d4ef8654bc458b83773898aa55b4.zip
Improve performance of setNeedsMeasure (#16972).
This change removes the method LayoutDependenyTree.setNeedsMeasure which takes a connectorId as first param. In all places where it is used, the ComponentConnector is actually known, so this change avoids looking it up over and over again. Also The lookup would need to lookup the ConnectorMap every time. Change-Id: I2593b0bede05cd69889ba68aac854cfba43f70b1
-rw-r--r--client/src/com/vaadin/client/LayoutManager.java17
-rw-r--r--client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java9
2 files changed, 19 insertions, 7 deletions
diff --git a/client/src/com/vaadin/client/LayoutManager.java b/client/src/com/vaadin/client/LayoutManager.java
index dfcf2cb5bb..828f0942b7 100644
--- a/client/src/com/vaadin/client/LayoutManager.java
+++ b/client/src/com/vaadin/client/LayoutManager.java
@@ -310,8 +310,11 @@ public class LayoutManager {
dump = needsMeasure.dump();
dumpLength = dump.length();
for (int i = 0; i < dumpLength; i++) {
- String layoutId = dump.get(i);
- currentDependencyTree.setNeedsMeasure(layoutId, true);
+ ServerConnector connector = connectorMap.getConnector(dump.get(i));
+ if (connector != null) {
+ currentDependencyTree.setNeedsMeasure(
+ (ComponentConnector) connector, true);
+ }
}
needsMeasure = FastStringSet.create();
@@ -661,7 +664,7 @@ public class LayoutManager {
parentElement.getStyle().setProperty("overflow",
originalOverflows.get(parentElement));
- layoutDependencyTree.setNeedsMeasure(connectorId, true);
+ layoutDependencyTree.setNeedsMeasure(componentConnector, true);
}
Profiler.leave("Overflow fix restore");
@@ -695,8 +698,7 @@ public class LayoutManager {
measureConnector(connectors.get(i));
}
for (int i = 0; i < connectorCount; i++) {
- layoutDependencyTree.setNeedsMeasure(connectors.get(i)
- .getConnectorId(), false);
+ layoutDependencyTree.setNeedsMeasure(connectors.get(i), false);
}
measureCount += connectorCount;
@@ -715,8 +717,9 @@ public class LayoutManager {
measureCount++;
}
for (int i = 0; i < length; i++) {
- String connectorId = measureTargets.get(i);
- layoutDependencyTree.setNeedsMeasure(connectorId, false);
+ ComponentConnector connector = (ComponentConnector) connectorMap
+ .getConnector(measureTargets.get(i));
+ layoutDependencyTree.setNeedsMeasure(connector, false);
}
}
Profiler.leave("Layout measure from tree");
diff --git a/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java b/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java
index af261c0208..07bb6688e3 100644
--- a/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java
+++ b/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java
@@ -429,6 +429,15 @@ public class LayoutDependencyTree {
setNeedsVerticalMeasure(connector, needsMeasure);
}
+ /**
+ * @param connectorId
+ * @param needsMeasure
+ *
+ * @deprecated As of 7.4.2, use
+ * {@link #setNeedsMeasure(ComponentConnector, boolean)} for
+ * improved performance.
+ */
+ @Deprecated
public void setNeedsMeasure(String connectorId, boolean needsMeasure) {
ComponentConnector connector = (ComponentConnector) ConnectorMap.get(
connection).getConnector(connectorId);