mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 245297 All views' refresh should clear their
relevant services cache
This commit is contained in:
parent
5700736f3f
commit
4c7c1efdb3
11 changed files with 111 additions and 12 deletions
|
@ -11,10 +11,17 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.modules;
|
||||
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
import org.eclipse.dd.dsf.concurrent.DsfRunnable;
|
||||
import org.eclipse.dd.dsf.debug.internal.ui.DsfDebugUIPlugin;
|
||||
import org.eclipse.dd.dsf.debug.service.ICachingService;
|
||||
import org.eclipse.dd.dsf.debug.service.IModules;
|
||||
import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
||||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMAdapter;
|
||||
import org.eclipse.dd.dsf.ui.viewmodel.IVMNode;
|
||||
import org.eclipse.dd.dsf.ui.viewmodel.IRootVMNode;
|
||||
import org.eclipse.dd.dsf.ui.viewmodel.IVMNode;
|
||||
import org.eclipse.dd.dsf.ui.viewmodel.datamodel.AbstractDMVMProvider;
|
||||
import org.eclipse.dd.dsf.ui.viewmodel.datamodel.RootDMVMNode;
|
||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
|
||||
|
@ -46,4 +53,23 @@ public class ModulesVMProvider extends AbstractDMVMProvider {
|
|||
*/
|
||||
setRootNode(rootNode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
super.refresh();
|
||||
try {
|
||||
getSession().getExecutor().execute(new DsfRunnable() {
|
||||
public void run() {
|
||||
DsfServicesTracker tracker = new DsfServicesTracker(DsfDebugUIPlugin.getBundleContext(), getSession().getId());
|
||||
IModules modulesService = tracker.getService(IModules.class);
|
||||
if (modulesService instanceof ICachingService) {
|
||||
((ICachingService)modulesService).flushCache(null);
|
||||
}
|
||||
tracker.dispose();
|
||||
}
|
||||
});
|
||||
} catch (RejectedExecutionException e) {
|
||||
// Session disposed, ignore.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.eclipse.dd.dsf.concurrent.RequestMonitor;
|
|||
import org.eclipse.dd.dsf.datamodel.AbstractDMContext;
|
||||
import org.eclipse.dd.dsf.datamodel.DMContexts;
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.ICachingService;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl;
|
||||
import org.eclipse.dd.dsf.debug.service.IStack;
|
||||
import org.eclipse.dd.dsf.debug.service.IStack2;
|
||||
|
@ -51,7 +52,7 @@ import org.osgi.framework.BundleContext;
|
|||
* this service is initialized.
|
||||
* </p>
|
||||
*/
|
||||
public class PDAStack extends AbstractDsfService implements IStack2 {
|
||||
public class PDAStack extends AbstractDsfService implements IStack2, ICachingService {
|
||||
|
||||
/**
|
||||
* PDA stack frame contains only the stack frame level. It is only
|
||||
|
@ -470,4 +471,8 @@ public class PDAStack extends AbstractDsfService implements IStack2 {
|
|||
fCommandCache.setContextAvailable(e.getDMContext(), true);
|
||||
fCommandCache.reset(e.getDMContext());
|
||||
}
|
||||
|
||||
public void flushCache(IDMContext context) {
|
||||
fCommandCache.reset(context);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,17 +11,26 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.gdb.internal.ui.viewmodel.launch;
|
||||
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
import org.eclipse.dd.dsf.concurrent.DsfRunnable;
|
||||
import org.eclipse.dd.dsf.concurrent.ThreadSafe;
|
||||
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.launch.AbstractLaunchVMProvider;
|
||||
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.launch.LaunchRootVMNode;
|
||||
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.launch.StackFramesVMNode;
|
||||
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.launch.StandardProcessVMNode;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent;
|
||||
import org.eclipse.dd.dsf.debug.service.ICachingService;
|
||||
import org.eclipse.dd.dsf.debug.service.IProcesses;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl;
|
||||
import org.eclipse.dd.dsf.debug.service.IStack;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommandControlService.ICommandControlInitializedDMEvent;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent;
|
||||
import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
||||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMAdapter;
|
||||
import org.eclipse.dd.dsf.ui.viewmodel.IRootVMNode;
|
||||
import org.eclipse.dd.dsf.ui.viewmodel.IVMNode;
|
||||
import org.eclipse.dd.gdb.internal.ui.GdbUIPlugin;
|
||||
import org.eclipse.dd.mi.service.command.MIInferiorProcess.InferiorExitedDMEvent;
|
||||
import org.eclipse.dd.mi.service.command.MIInferiorProcess.InferiorStartedDMEvent;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
|
@ -81,4 +90,30 @@ public class LaunchVMProvider extends AbstractLaunchVMProvider
|
|||
return super.canSkipHandlingEvent(newEvent, eventToSkip);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
super.refresh();
|
||||
try {
|
||||
getSession().getExecutor().execute(new DsfRunnable() {
|
||||
public void run() {
|
||||
DsfServicesTracker tracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), getSession().getId());
|
||||
IProcesses processesService = tracker.getService(IProcesses.class);
|
||||
if (processesService instanceof ICachingService) {
|
||||
((ICachingService)processesService).flushCache(null);
|
||||
}
|
||||
IStack stackService = tracker.getService(IStack.class);
|
||||
if (stackService instanceof ICachingService) {
|
||||
((ICachingService)stackService).flushCache(null);
|
||||
}
|
||||
IRunControl runControlService = tracker.getService(IRunControl.class);
|
||||
if (runControlService instanceof ICachingService) {
|
||||
((ICachingService)runControlService).flushCache(null);
|
||||
}
|
||||
tracker.dispose();
|
||||
}
|
||||
});
|
||||
} catch (RejectedExecutionException e) {
|
||||
// Session disposed, ignore.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.eclipse.dd.dsf.datamodel.AbstractDMContext;
|
|||
import org.eclipse.dd.dsf.datamodel.AbstractDMEvent;
|
||||
import org.eclipse.dd.dsf.datamodel.DMContexts;
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.ICachingService;
|
||||
import org.eclipse.dd.dsf.debug.service.IProcesses;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerResumedDMEvent;
|
||||
|
@ -66,7 +67,7 @@ import org.osgi.framework.BundleContext;
|
|||
* which really mean it supports the new -list-thread-groups command.
|
||||
*
|
||||
*/
|
||||
public class GDBProcesses_7_0 extends AbstractDsfService implements IMIProcesses {
|
||||
public class GDBProcesses_7_0 extends AbstractDsfService implements IMIProcesses, ICachingService {
|
||||
|
||||
// Below is the context hierarchy that is implemented between the
|
||||
// MIProcesses service and the MIRunControl service for the MI
|
||||
|
@ -767,4 +768,10 @@ public class GDBProcesses_7_0 extends AbstractDsfService implements IMIProcesses
|
|||
fThreadCommandCache.reset();
|
||||
}
|
||||
}
|
||||
|
||||
public void flushCache(IDMContext context) {
|
||||
fContainerCommandCache.reset(context);
|
||||
fThreadCommandCache.reset(context);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -914,7 +914,10 @@ public class ExpressionService extends AbstractDsfService implements IExpression
|
|||
}
|
||||
|
||||
public void flushCache(IDMContext context) {
|
||||
fExpressionCache.reset();
|
||||
fExpressionCache.reset(context);
|
||||
// We must also mark all variable objects as out-of-date
|
||||
// to refresh them as well
|
||||
varManager.markAllOutOfDate();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.eclipse.dd.dsf.concurrent.RequestMonitor;
|
|||
import org.eclipse.dd.dsf.datamodel.AbstractDMContext;
|
||||
import org.eclipse.dd.dsf.datamodel.DMContexts;
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.ICachingService;
|
||||
import org.eclipse.dd.dsf.debug.service.IModules;
|
||||
import org.eclipse.dd.dsf.debug.service.command.CommandCache;
|
||||
import org.eclipse.dd.dsf.service.AbstractDsfService;
|
||||
|
@ -36,7 +37,7 @@ import org.osgi.framework.BundleContext;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class MIModules extends AbstractDsfService implements IModules {
|
||||
public class MIModules extends AbstractDsfService implements IModules, ICachingService {
|
||||
private CommandCache fModulesCache;
|
||||
|
||||
public MIModules(DsfSession session) {
|
||||
|
@ -216,4 +217,8 @@ public class MIModules extends AbstractDsfService implements IModules {
|
|||
rm.setStatus(new Status(IStatus.ERROR, MIPlugin.PLUGIN_ID, NOT_SUPPORTED, "Functionality not supported", null)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
}
|
||||
|
||||
public void flushCache(IDMContext context) {
|
||||
fModulesCache.reset();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.eclipse.dd.dsf.datamodel.AbstractDMContext;
|
|||
import org.eclipse.dd.dsf.datamodel.AbstractDMEvent;
|
||||
import org.eclipse.dd.dsf.datamodel.DMContexts;
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.ICachingService;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerResumedDMEvent;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerSuspendedDMEvent;
|
||||
|
@ -44,7 +45,7 @@ import org.eclipse.dd.mi.service.command.output.MIThreadListIdsInfo;
|
|||
import org.osgi.framework.BundleContext;
|
||||
|
||||
|
||||
public class MIProcesses extends AbstractDsfService implements IMIProcesses {
|
||||
public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICachingService {
|
||||
|
||||
// Below is the context hierarchy that is implemented between the
|
||||
// MIProcesses service and the MIRunControl service for the MI
|
||||
|
@ -642,4 +643,8 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses {
|
|||
fContainerCommandCache.reset();
|
||||
}
|
||||
|
||||
public void flushCache(IDMContext context) {
|
||||
fContainerCommandCache.reset(context);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.eclipse.dd.dsf.datamodel.AbstractDMEvent;
|
|||
import org.eclipse.dd.dsf.datamodel.DMContexts;
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.dsf.datamodel.IDMEvent;
|
||||
import org.eclipse.dd.dsf.debug.service.ICachingService;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl;
|
||||
import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.command.CommandCache;
|
||||
|
@ -72,7 +73,7 @@ import org.osgi.framework.BundleContext;
|
|||
* events and track service state, to be perfectly in sync with the service
|
||||
* state.
|
||||
*/
|
||||
public class MIRunControl extends AbstractDsfService implements IRunControl
|
||||
public class MIRunControl extends AbstractDsfService implements IRunControl, ICachingService
|
||||
{
|
||||
@Deprecated
|
||||
protected class MIExecutionDMC extends AbstractDMContext implements IMIExecutionDMContext
|
||||
|
@ -676,4 +677,8 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
|
|||
rm.done();
|
||||
}
|
||||
}
|
||||
|
||||
public void flushCache(IDMContext context) {
|
||||
fMICommandCache.reset(context);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.eclipse.dd.dsf.datamodel.AbstractDMEvent;
|
|||
import org.eclipse.dd.dsf.datamodel.DMContexts;
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.dsf.datamodel.IDMEvent;
|
||||
import org.eclipse.dd.dsf.debug.service.ICachingService;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl;
|
||||
import org.eclipse.dd.dsf.debug.service.IProcesses.IProcessDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IProcesses.IThreadDMContext;
|
||||
|
@ -69,7 +70,7 @@ import org.osgi.framework.BundleContext;
|
|||
* that listen to service events and track service state, to be perfectly in
|
||||
* sync with the service state.
|
||||
*/
|
||||
public class MIRunControlNS extends AbstractDsfService implements IRunControl
|
||||
public class MIRunControlNS extends AbstractDsfService implements IRunControl, ICachingService
|
||||
{
|
||||
@Immutable
|
||||
private static class ExecutionData implements IExecutionDMData {
|
||||
|
@ -766,4 +767,7 @@ public class MIRunControlNS extends AbstractDsfService implements IRunControl
|
|||
fTerminated = true;
|
||||
}
|
||||
|
||||
public void flushCache(IDMContext context) {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.eclipse.dd.dsf.concurrent.RequestMonitor;
|
|||
import org.eclipse.dd.dsf.datamodel.AbstractDMContext;
|
||||
import org.eclipse.dd.dsf.datamodel.DMContexts;
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.ICachingService;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl;
|
||||
import org.eclipse.dd.dsf.debug.service.IStack;
|
||||
import org.eclipse.dd.dsf.debug.service.IStack2;
|
||||
|
@ -55,7 +56,7 @@ import org.eclipse.dd.mi.service.command.output.MIStackListLocalsInfo;
|
|||
import org.osgi.framework.BundleContext;
|
||||
|
||||
public class MIStack extends AbstractDsfService
|
||||
implements IStack2
|
||||
implements IStack2, ICachingService
|
||||
{
|
||||
protected static class MIFrameDMC extends AbstractDMContext
|
||||
implements IFrameDMContext
|
||||
|
@ -666,4 +667,8 @@ public class MIStack extends AbstractDsfService
|
|||
}
|
||||
}
|
||||
|
||||
public void flushCache(IDMContext context) {
|
||||
fMICommandCache.reset(context);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -941,7 +941,6 @@ public class MIVariableManager implements ICommandControl {
|
|||
|
||||
public boolean isUpdating() { return currentState == STATE_UPDATING; }
|
||||
|
||||
public boolean isOutOfDate() { return outOfDate; }
|
||||
public void markAsOutOfDate() { outOfDate = true; }
|
||||
|
||||
// Remember that we must add ourself as a modifiable descendant if our value can change
|
||||
|
@ -1679,7 +1678,7 @@ public class MIVariableManager implements ICommandControl {
|
|||
}
|
||||
}
|
||||
|
||||
private void markAllOutOfDate() {
|
||||
public void markAllOutOfDate() {
|
||||
MIRootVariableObject root;
|
||||
while ((root = updatedRootList.poll()) != null) {
|
||||
root.markAsOutOfDate();
|
||||
|
|
Loading…
Add table
Reference in a new issue