@@ -4,15 +4,13 @@ try {throw new Error(); } catch (e) {firstLineError = e;}
4
4
var ASSERT = require ( "./assert" ) ;
5
5
var schedule = require ( "./schedule" ) ;
6
6
var Queue = require ( "./queue" ) ;
7
- var util = require ( "./util" ) ;
8
7
9
8
function Async ( ) {
10
9
this . _customScheduler = false ;
11
10
this . _isTickUsed = false ;
12
11
this . _lateQueue = new Queue ( LATE_QUEUE_CAPACITY ) ;
13
12
this . _normalQueue = new Queue ( NORMAL_QUEUE_CAPACITY ) ;
14
13
this . _haveDrainedQueues = false ;
15
- this . _trampolineEnabled = true ;
16
14
var self = this ;
17
15
this . drainQueues = function ( ) {
18
16
self . _drainQueues ( ) ;
@@ -31,16 +29,6 @@ Async.prototype.hasCustomScheduler = function() {
31
29
return this . _customScheduler ;
32
30
} ;
33
31
34
- Async . prototype . enableTrampoline = function ( ) {
35
- this . _trampolineEnabled = true ;
36
- } ;
37
-
38
- Async . prototype . disableTrampolineIfNecessary = function ( ) {
39
- if ( util . hasDevTools ) {
40
- this . _trampolineEnabled = false ;
41
- }
42
- } ;
43
-
44
32
Async . prototype . haveItemsQueued = function ( ) {
45
33
return this . _isTickUsed || this . _haveDrainedQueues ;
46
34
} ;
@@ -94,43 +82,10 @@ function AsyncSettlePromises(promise) {
94
82
this . _queueTick ( ) ;
95
83
}
96
84
97
- if ( ! util . hasDevTools ) {
98
- Async . prototype . invokeLater = AsyncInvokeLater ;
99
- Async . prototype . invoke = AsyncInvoke ;
100
- Async . prototype . settlePromises = AsyncSettlePromises ;
101
- } else {
102
- Async . prototype . invokeLater = function ( fn , receiver , arg ) {
103
- if ( this . _trampolineEnabled ) {
104
- AsyncInvokeLater . call ( this , fn , receiver , arg ) ;
105
- } else {
106
- this . _schedule ( function ( ) {
107
- setTimeout ( function ( ) {
108
- fn . call ( receiver , arg ) ;
109
- } , 100 ) ;
110
- } ) ;
111
- }
112
- } ;
113
-
114
- Async . prototype . invoke = function ( fn , receiver , arg ) {
115
- if ( this . _trampolineEnabled ) {
116
- AsyncInvoke . call ( this , fn , receiver , arg ) ;
117
- } else {
118
- this . _schedule ( function ( ) {
119
- fn . call ( receiver , arg ) ;
120
- } ) ;
121
- }
122
- } ;
85
+ Async . prototype . invokeLater = AsyncInvokeLater ;
86
+ Async . prototype . invoke = AsyncInvoke ;
87
+ Async . prototype . settlePromises = AsyncSettlePromises ;
123
88
124
- Async . prototype . settlePromises = function ( promise ) {
125
- if ( this . _trampolineEnabled ) {
126
- AsyncSettlePromises . call ( this , promise ) ;
127
- } else {
128
- this . _schedule ( function ( ) {
129
- promise . _settlePromises ( ) ;
130
- } ) ;
131
- }
132
- } ;
133
- }
134
89
135
90
function _drainQueue ( queue ) {
136
91
while ( queue . length ( ) > 0 ) {
0 commit comments