@@ -6,7 +6,6 @@ package kotlinx.coroutines.test
6
6
7
7
import kotlinx.coroutines.*
8
8
import kotlin.coroutines.*
9
- import kotlin.jvm.*
10
9
11
10
/* *
12
11
* [CoroutineDispatcher] that performs both immediate and lazy execution of coroutines in tests
@@ -35,6 +34,7 @@ public class TestCoroutineDispatcher(public override val scheduler: TestCoroutin
35
34
}
36
35
}
37
36
37
+ /* * @suppress */
38
38
override fun processEvent (time : Long , marker : Any ) {
39
39
check(marker is Runnable )
40
40
marker.run ()
@@ -51,25 +51,11 @@ public class TestCoroutineDispatcher(public override val scheduler: TestCoroutin
51
51
}
52
52
53
53
/* * @suppress */
54
- @InternalCoroutinesApi
55
54
override fun dispatchYield (context : CoroutineContext , block : Runnable ) {
56
55
checkSchedulerInContext(scheduler, context)
57
56
post(block)
58
57
}
59
58
60
- /* * @suppress */
61
- override fun scheduleResumeAfterDelay (timeMillis : Long , continuation : CancellableContinuation <Unit >) {
62
- checkSchedulerInContext(scheduler, continuation.context)
63
- val timedRunnable = CancellableContinuationRunnable (continuation, this )
64
- scheduler.registerEvent(this , timeMillis, timedRunnable, ::cancellableRunnableIsCancelled)
65
- }
66
-
67
- /* * @suppress */
68
- override fun invokeOnTimeout (timeMillis : Long , block : Runnable , context : CoroutineContext ): DisposableHandle {
69
- checkSchedulerInContext(scheduler, context)
70
- return scheduler.registerEvent(this , timeMillis, block) { false }
71
- }
72
-
73
59
/* * @suppress */
74
60
override fun toString (): String = " TestCoroutineDispatcher[scheduler=$scheduler ]"
75
61
@@ -97,17 +83,3 @@ public class TestCoroutineDispatcher(public override val scheduler: TestCoroutin
97
83
dispatchImmediately = true
98
84
}
99
85
}
100
-
101
- /* *
102
- * This class exists to allow cleanup code to avoid throwing for cancelled continuations scheduled
103
- * in the future.
104
- */
105
- private class CancellableContinuationRunnable (
106
- @JvmField val continuation : CancellableContinuation <Unit >,
107
- private val dispatcher : CoroutineDispatcher
108
- ) : Runnable {
109
- override fun run () = with (dispatcher) { with (continuation) { resumeUndispatched(Unit ) } }
110
- }
111
-
112
- private fun cancellableRunnableIsCancelled (runnable : CancellableContinuationRunnable ): Boolean =
113
- ! runnable.continuation.isActive
0 commit comments