mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
[debugger] Hide thread model counter handling from public API
GitOrigin-RevId: 56eee01ed400e242f431b7dcd004d7622ca5063f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2ea7b25fb9
commit
9e5909a854
@@ -338,7 +338,7 @@ public class DebugProcessEvents extends DebugProcessImpl {
|
||||
if (oldThread == null) {
|
||||
switch (suspendContext.getSuspendPolicy()) {
|
||||
case EventRequest.SUSPEND_ALL -> suspendContext.getDebugProcess().getVirtualMachineProxy().addedSuspendAllContext();
|
||||
case EventRequest.SUSPEND_EVENT_THREAD -> Objects.requireNonNull(suspendContext.getEventThread()).suspendedThreadContext();
|
||||
case EventRequest.SUSPEND_EVENT_THREAD -> Objects.requireNonNull(suspendContext.getEventThread()).threadWasSuspended();
|
||||
}
|
||||
//this is the first event in the eventSet that we process
|
||||
suspendContext.getDebugProcess().beforeSuspend(suspendContext);
|
||||
|
||||
@@ -96,7 +96,7 @@ public class SuspendManagerImpl implements SuspendManager {
|
||||
myDebugProcess.logThreads();
|
||||
switch (getSuspendPolicy()) {
|
||||
case EventRequest.SUSPEND_ALL -> myDebugProcess.getVirtualMachineProxy().resumedSuspendAllContext();
|
||||
case EventRequest.SUSPEND_EVENT_THREAD -> Objects.requireNonNull(getEventThread()).resumedSuspendThreadContext();
|
||||
case EventRequest.SUSPEND_EVENT_THREAD -> Objects.requireNonNull(getEventThread()).threadWasResumed();
|
||||
}
|
||||
DebuggerUtilsAsync.resume(set);
|
||||
LOG.debug("Set resumed ");
|
||||
|
||||
@@ -123,7 +123,6 @@ public final class EvaluationContextImpl implements EvaluationContext {
|
||||
assert myThreadForEvaluation == null;
|
||||
assert !mySuspendContext.isEvaluating();
|
||||
assert !threadForEvaluation.isEvaluating();
|
||||
threadForEvaluation.resumedSuspendThreadContext();
|
||||
threadForEvaluation.setEvaluating(true);
|
||||
mySuspendContext.setIsEvaluating(this);
|
||||
}
|
||||
@@ -131,7 +130,6 @@ public final class EvaluationContextImpl implements EvaluationContext {
|
||||
assert myThreadForEvaluation != null;
|
||||
assert myThreadForEvaluation.isEvaluating();
|
||||
assert mySuspendContext.getEvaluationContext() == this;
|
||||
myThreadForEvaluation.suspendedThreadContext();
|
||||
mySuspendContext.setIsEvaluating(null);
|
||||
myThreadForEvaluation.setEvaluating(false);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ public final class ThreadReferenceProxyImpl extends ObjectReferenceProxyImpl imp
|
||||
|
||||
private volatile boolean myIsEvaluating = false;
|
||||
|
||||
// This counter can go negative value if the engine stops the whole JVM, but resumed this particular thread
|
||||
public int myModelSuspendCount = 0;
|
||||
|
||||
public static final Comparator<ThreadReferenceProxyImpl> ourComparator = (th1, th2) -> {
|
||||
@@ -113,6 +114,7 @@ public final class ThreadReferenceProxyImpl extends ObjectReferenceProxyImpl imp
|
||||
myListeners.getMulticaster().threadSuspended();
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public void suspendImpl() {
|
||||
myModelSuspendCount++;
|
||||
getThreadReference().suspend();
|
||||
@@ -140,6 +142,7 @@ public final class ThreadReferenceProxyImpl extends ObjectReferenceProxyImpl imp
|
||||
myListeners.getMulticaster().threadResumed();
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public void resumeImpl() {
|
||||
myModelSuspendCount--;
|
||||
DebuggerUtilsAsync.resume(getThreadReference());
|
||||
@@ -466,11 +469,13 @@ public final class ThreadReferenceProxyImpl extends ObjectReferenceProxyImpl imp
|
||||
return myModelSuspendCount + getVirtualMachine().getModelSuspendCount();
|
||||
}
|
||||
|
||||
public void suspendedThreadContext() {
|
||||
@ApiStatus.Internal
|
||||
public void threadWasSuspended() {
|
||||
myModelSuspendCount++;
|
||||
}
|
||||
|
||||
public void resumedSuspendThreadContext() {
|
||||
@ApiStatus.Internal
|
||||
public void threadWasResumed() {
|
||||
myModelSuspendCount--;
|
||||
}
|
||||
|
||||
@@ -491,6 +496,12 @@ public final class ThreadReferenceProxyImpl extends ObjectReferenceProxyImpl imp
|
||||
@ApiStatus.Internal
|
||||
public void setEvaluating(boolean evaluating) {
|
||||
myIsEvaluating = evaluating;
|
||||
if (evaluating) {
|
||||
threadWasResumed();
|
||||
}
|
||||
else {
|
||||
threadWasSuspended();
|
||||
}
|
||||
}
|
||||
|
||||
public interface ThreadListener extends EventListener{
|
||||
|
||||
Reference in New Issue
Block a user