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:
parent
c99f13bd17
commit
0b19264891
3 changed files with 45 additions and 45 deletions
|
@ -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,36 +890,36 @@ 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) {
|
||||
@Override
|
||||
public void handleCompleted() {
|
||||
// Now that all the calls to getModelData() are complete, we create an
|
||||
// IExpressionDMContext object for each local variable name, saving them all
|
||||
// in an array.
|
||||
final CountingRequestMonitor crm = new CountingRequestMonitor(dsfExecutor, null) {
|
||||
@Override
|
||||
public void handleCompleted() {
|
||||
// Now that all the calls to getModelData() are complete, we create an
|
||||
// IExpressionDMContext object for each local variable name, saving them all
|
||||
// in an array.
|
||||
|
||||
if (!isSuccess()) {
|
||||
handleFailedUpdate(update);
|
||||
return;
|
||||
}
|
||||
|
||||
IExpressionDMContext[] expressionDMCs = new IExpressionDMContext[localsDMData.size()];
|
||||
|
||||
int i = 0;
|
||||
|
||||
for (IVariableDMData localDMData : localsDMData) {
|
||||
expressionDMCs[i++] = expressionService.createExpression(frameDmc, localDMData.getName());
|
||||
}
|
||||
|
||||
// Lastly, we fill the update from the array of view model context objects
|
||||
// that reference the ExpressionDMC objects for the local variables. This is
|
||||
// the last code to run for a given call to updateElementsInSessionThread().
|
||||
// We can now leave anonymous-inner-class hell.
|
||||
|
||||
fillUpdateWithVMCs(update, expressionDMCs);
|
||||
update.done();
|
||||
if (!isSuccess()) {
|
||||
handleFailedUpdate(update);
|
||||
return;
|
||||
}
|
||||
|
||||
IExpressionDMContext[] expressionDMCs = new IExpressionDMContext[localsDMData.size()];
|
||||
|
||||
int i = 0;
|
||||
|
||||
for (IVariableDMData localDMData : localsDMData) {
|
||||
expressionDMCs[i++] = expressionService.createExpression(frameDmc, localDMData.getName());
|
||||
}
|
||||
|
||||
// Lastly, we fill the update from the array of view model context objects
|
||||
// that reference the ExpressionDMC objects for the local variables. This is
|
||||
// the last code to run for a given call to updateElementsInSessionThread().
|
||||
// We can now leave anonymous-inner-class hell.
|
||||
|
||||
fillUpdateWithVMCs(update, expressionDMCs);
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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>();
|
||||
|
@ -660,7 +658,8 @@ public class DefaultVMModelProxyStrategy implements IVMModelProxy {
|
|||
rm.setData(data);
|
||||
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++) {
|
||||
|
|
Loading…
Add table
Reference in a new issue