Skip to content

Commit a919827

Browse files
committed
MPP: DefaultDispatcher internal impl class renamed to JSDispatcher
1 parent 3d765a8 commit a919827

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

js/kotlinx-coroutines-core-js/src/main/kotlin/kotlinx/coroutines/experimental/CoroutineContext.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ public actual object Unconfined : CoroutineDispatcher() {
4141
* [launch], [async], etc if no dispatcher nor any other [ContinuationInterceptor] is specified in their context.
4242
*/
4343
@Suppress("PropertyName")
44-
public actual val DefaultDispatcher: CoroutineDispatcher = DefaultExecutor
44+
public actual val DefaultDispatcher: CoroutineDispatcher = JSDispatcher
4545

46-
internal object DefaultExecutor : CoroutineDispatcher(), Delay {
46+
internal object JSDispatcher : CoroutineDispatcher(), Delay {
4747
fun enqueue(block: Runnable) {
4848
setTimeout({ block.run() }, 0)
4949
}

js/kotlinx-coroutines-core-js/src/main/kotlin/kotlinx/coroutines/experimental/Delay.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@ public actual suspend fun delay(time: Int) {
7272
}
7373

7474
/** Returns [Delay] implementation of the given context */
75-
internal val CoroutineContext.delay: Delay get() = get(ContinuationInterceptor) as? Delay ?: DefaultExecutor
75+
internal val CoroutineContext.delay: Delay get() = get(ContinuationInterceptor) as? Delay ?: JSDispatcher

js/kotlinx-coroutines-core-js/src/main/kotlin/kotlinx/coroutines/experimental/EventLoop.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ internal abstract class EventLoopBase: CoroutineDispatcher(), Delay, EventLoop {
9090

9191
private fun enqueue(queuedTask: QueuedTask) {
9292
if (!enqueueImpl(queuedTask))
93-
DefaultExecutor.enqueue(queuedTask)
93+
JSDispatcher.enqueue(queuedTask)
9494
}
9595

9696
private fun enqueueImpl(queuedTask: QueuedTask): Boolean {
@@ -102,7 +102,7 @@ internal abstract class EventLoopBase: CoroutineDispatcher(), Delay, EventLoop {
102102
private fun schedule(delayedTask: DelayedTask) {
103103
if (!scheduleImpl(delayedTask)) {
104104
val remaining = delayedTask.time - now()
105-
DefaultExecutor.schedule(remaining, delayedTask)
105+
JSDispatcher.schedule(remaining, delayedTask)
106106
}
107107
}
108108

@@ -152,15 +152,15 @@ internal abstract class EventLoopBase: CoroutineDispatcher(), Delay, EventLoop {
152152
if (state != DELAYED) return
153153
if (delayed?.remove(this) == true) {
154154
state = RESCHEDULED
155-
handle = DefaultExecutor.schedule(time,this)
155+
handle = JSDispatcher.schedule(time,this)
156156
} else
157157
state = REMOVED
158158
}
159159

160160
final override fun dispose() {
161161
when (state) {
162162
DELAYED -> delayed?.remove(this)
163-
RESCHEDULED -> DefaultExecutor.removeScheduled(handle)
163+
RESCHEDULED -> JSDispatcher.removeScheduled(handle)
164164
else -> return
165165
}
166166
state = REMOVED

0 commit comments

Comments
 (0)