1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 09:46:02 +02:00

[291224] Heavy MultiRequestMonitor used where lighter CountingRequestMonitor equally does the job

This commit is contained in:
John Cortell 2009-10-02 16:22:59 +00:00
parent abd87e7609
commit c99f13bd17

View file

@ -525,11 +525,13 @@ public class DefaultVMModelProxyStrategy implements IVMModelProxy {
protected void handleCompleted() { protected void handleCompleted() {
if (fDisposed) return; if (fDisposed) return;
final List<Object> childElements = getData();
// Check for an empty list of elements. If the list of elements is empty // Check for an empty list of elements. If the list of elements is empty
// still call the child nodes using the parent delta only. Do this only if // still call the child nodes using the parent delta only. Do this only if
// an optimization was used to build the delta, so that the child node can // an optimization was used to build the delta, so that the child node can
// adds the optimized delta flags without the full delta (bug 280770). // adds the optimized delta flags without the full delta (bug 280770).
if (getData() == null || getData().size() == 0) { if (childElements == null || childElements.size() == 0) {
if (updateFlagsOnly) { if (updateFlagsOnly) {
callChildNodesToBuildDelta( callChildNodesToBuildDelta(
node, childNodesWithDeltaFlags, parentDelta, event, rm); node, childNodesWithDeltaFlags, parentDelta, event, rm);
@ -538,26 +540,21 @@ public class DefaultVMModelProxyStrategy implements IVMModelProxy {
return; return;
} }
} else { } else {
final MultiRequestMonitor<RequestMonitor> elementsDeltasMultiRequestMon = final CountingRequestMonitor countingRM = new CountingRequestMonitor(getVMProvider().getExecutor(), rm);
new MultiRequestMonitor<RequestMonitor>(getVMProvider().getExecutor(), rm); int rmCount = 0;
// For each element from this node, create a new delta, // For each element from this node, create a new delta,
// and then call all the child nodes to build their delta. // and then call all the child nodes to build their delta.
for (int i = 0; i < getData().size(); i++) { for (int i = 0; i < childElements.size(); i++) {
int elementIndex = nodeOffset >= 0 ? nodeOffset + i : -1; int elementIndex = nodeOffset >= 0 ? nodeOffset + i : -1;
VMDelta delta= parentDelta.getChildDelta(getData().get(i)); VMDelta delta= parentDelta.getChildDelta(childElements.get(i));
if (delta == null) { if (delta == null) {
delta= parentDelta.addNode(getData().get(i), elementIndex, IModelDelta.NO_CHANGE); delta= parentDelta.addNode(childElements.get(i), elementIndex, IModelDelta.NO_CHANGE);
} }
callChildNodesToBuildDelta( callChildNodesToBuildDelta(node, childNodesWithDeltaFlags, delta, event, countingRM);
node, childNodesWithDeltaFlags, delta, event, rmCount++;
elementsDeltasMultiRequestMon.add(new RequestMonitor(getVMProvider().getExecutor(), null) {
@Override
protected void handleCompleted() {
elementsDeltasMultiRequestMon.requestMonitorDone(this);
}
}));
} }
countingRM.setDoneCount(rmCount);
} }
} }
}) })