1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

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

This commit is contained in:
John Cortell 2009-10-02 20:07:37 +00:00
parent c99f13bd17
commit 0b19264891
3 changed files with 45 additions and 45 deletions

View file

@ -26,7 +26,6 @@ import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
import org.eclipse.cdt.dsf.concurrent.MultiRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
@ -891,8 +890,7 @@ public class VariableVMNode extends AbstractExpressionVMNode
// Create the MultiRequestMonitor to handle completion of the set of getModelData() calls.
final MultiRequestMonitor<DataRequestMonitor<IVariableDMData>> mrm =
new MultiRequestMonitor<DataRequestMonitor<IVariableDMData>>(dsfExecutor, null) {
final CountingRequestMonitor crm = new CountingRequestMonitor(dsfExecutor, null) {
@Override
public void handleCompleted() {
// Now that all the calls to getModelData() are complete, we create an
@ -921,6 +919,7 @@ public class VariableVMNode extends AbstractExpressionVMNode
update.done();
}
};
int countRM = 0;
// Perform a set of getModelData() calls, one for each local variable's data model
// context object. In the handleCompleted() method of the DataRequestMonitor, add the
@ -932,14 +931,14 @@ public class VariableVMNode extends AbstractExpressionVMNode
@Override
public void handleCompleted() {
localsDMData.add(getData());
mrm.requestMonitorDone(this);
crm.done();
}
};
mrm.add(rm);
stackFrameService.getVariableData(localDMC, rm);
countRM++;
}
crm.setDoneCount(countRM);
}
};

View file

@ -19,7 +19,6 @@ import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor;
import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.MultiRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.ui.concurrent.ViewerCountingRequestMonitor;
import org.eclipse.cdt.dsf.ui.concurrent.ViewerDataRequestMonitor;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate;
@ -261,30 +260,32 @@ public class DefaultVMContentProviderStrategy implements IElementContentProvider
// Get the mapping of all the counts.
final Integer[] counts = new Integer[childNodes.length];
final MultiRequestMonitor<RequestMonitor> childrenCountMultiReqMon = new MultiRequestMonitor<RequestMonitor>(
getVMProvider().getExecutor(), rm) {
final CountingRequestMonitor crm = new CountingRequestMonitor(getVMProvider().getExecutor(), rm) {
@Override
protected void handleSuccess() {
rm.setData(counts);
rm.done();
}
};
int countRM = 0;
for (int i = 0; i < childNodes.length; i++) {
final int nodeIndex = i;
getVMProvider().updateNode(
childNodes[i],
new VMChildrenCountUpdate(update, childrenCountMultiReqMon.add(new ViewerDataRequestMonitor<Integer>(
new VMChildrenCountUpdate(update, new ViewerDataRequestMonitor<Integer>(
getVMProvider().getExecutor(), update) {
@Override
protected void handleCompleted() {
if (isSuccess()) {
counts[nodeIndex] = getData();
}
childrenCountMultiReqMon.requestMonitorDone(this);
crm.done();
}
})));
}));
countRM++;
}
crm.setDoneCount(countRM);
}
/**

View file

@ -20,7 +20,6 @@ import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
import org.eclipse.cdt.dsf.concurrent.MultiRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.ListenerList;
@ -645,8 +644,7 @@ public class DefaultVMModelProxyStrategy implements IVMModelProxy {
if (calculdateOffsets) {
final Integer[] counts = new Integer[childNodes.length];
final MultiRequestMonitor<RequestMonitor> childrenCountMultiRequestMon =
new MultiRequestMonitor<RequestMonitor>(getVMProvider().getExecutor(), rm) {
final CountingRequestMonitor crm = new CountingRequestMonitor(getVMProvider().getExecutor(), rm) {
@Override
protected void handleSuccess() {
Map<IVMNode, Integer> data = new HashMap<IVMNode, Integer>();
@ -661,6 +659,7 @@ public class DefaultVMModelProxyStrategy implements IVMModelProxy {
rm.done();
}
};
int countRM = 0;
for (int i = 0; i < childNodes.length; i++) {
final int nodeIndex = i;
@ -668,17 +667,18 @@ public class DefaultVMModelProxyStrategy implements IVMModelProxy {
childNodes[i],
new VMChildrenCountUpdate(
delta, getVMProvider().getPresentationContext(),
childrenCountMultiRequestMon.add(
new DataRequestMonitor<Integer>(getVMProvider().getExecutor(), rm) {
new DataRequestMonitor<Integer>(getVMProvider().getExecutor(), crm) {
@Override
protected void handleCompleted() {
counts[nodeIndex] = getData();
childrenCountMultiRequestMon.requestMonitorDone(this);
crm.done();
}
}
})
)
);
countRM++;
}
crm.setDoneCount(countRM);
} else {
Map<IVMNode, Integer> data = new HashMap<IVMNode, Integer>();
for (int i = 0; i < childNodes.length; i++) {