Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Parts Copyright 2005-2009, the Dojo Foundation. Used under the terms of the | 5 // Parts Copyright 2005-2009, the Dojo Foundation. Used under the terms of the |
| 6 // "New" BSD License: | 6 // "New" BSD License: |
| 7 // | 7 // |
| 8 // http://download.dojotoolkit.org/release-1.3.2/dojo-release-1.3.2/dojo/LICENS E | 8 // http://download.dojotoolkit.org/release-1.3.2/dojo-release-1.3.2/dojo/LICENS E |
| 9 // | 9 // |
| 10 | 10 |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 594 this.results = [ null, null ]; | 594 this.results = [ null, null ]; |
| 595 this.canceller = canceller; | 595 this.canceller = canceller; |
| 596 // FIXME(slightlyoff): is it really smart to be creating this many timers? | 596 // FIXME(slightlyoff): is it really smart to be creating this many timers? |
| 597 if (typeof timeout == 'number') { | 597 if (typeof timeout == 'number') { |
| 598 if (timeout <= 0) { | 598 if (timeout <= 0) { |
| 599 timeout = 216000; // give it an hour | 599 timeout = 216000; // give it an hour |
| 600 } | 600 } |
| 601 } | 601 } |
| 602 this._timer = setTimeout( | 602 this._timer = setTimeout( |
| 603 hitch(this, 'errback', new Error('timeout')), | 603 hitch(this, 'errback', new Error('timeout')), |
| 604 (timeout || 1000) | 604 (timeout || 10000) |
| 605 ); | 605 ); |
| 606 this.silentlyCancelled = false; | 606 this.silentlyCancelled = false; |
| 607 }; | 607 }; |
| 608 | 608 |
| 609 /** | 609 /** |
| 610 * Cancels a Deferred that has not yet received a value, or is waiting on | 610 * Cancels a Deferred that has not yet received a value, or is waiting on |
| 611 * another Deferred as its value. If a canceller is defined, the canceller | 611 * another Deferred as its value. If a canceller is defined, the canceller |
| 612 * is called. If the canceller did not return an error, or there was no | 612 * is called. If the canceller did not return an error, or there was no |
| 613 * canceller, then the errback chain is started. | 613 * canceller, then the errback chain is started. |
| 614 * @public | 614 * @public |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 774 /** | 774 /** |
| 775 * Used internally to exhaust the callback sequence when a result is | 775 * Used internally to exhaust the callback sequence when a result is |
| 776 * available. | 776 * available. |
| 777 * @private | 777 * @private |
| 778 */ | 778 */ |
| 779 Deferred.prototype._fire = function() { | 779 Deferred.prototype._fire = function() { |
| 780 var chain = this.chain; | 780 var chain = this.chain; |
| 781 var fired = this.fired; | 781 var fired = this.fired; |
| 782 var res = this.results[fired]; | 782 var res = this.results[fired]; |
| 783 var cb = null; | 783 var cb = null; |
| 784 while ((chain.length > 0) && (this.paused == 0)) { | 784 while ((chain.length) && (!this.paused)) { |
| 785 var f = chain.shift()[fired]; | 785 var f = chain.shift()[fired]; |
| 786 if (!f) { | 786 if (!f) { |
| 787 continue; | 787 continue; |
| 788 } | 788 } |
| 789 var func = hitch(this, function() { | 789 var func = hitch(this, function() { |
| 790 var ret = f(res); | 790 var ret = f(res); |
| 791 //If no response, then use previous response. | 791 //If no response, then use previous response. |
| 792 if (typeof ret != undefStr) { | 792 if (typeof ret != undefStr) { |
| 793 res = ret; | 793 res = ret; |
| 794 } | 794 } |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1189 | 1189 |
| 1190 if (instance['tagName']) { | 1190 if (instance['tagName']) { |
| 1191 instance.listen('load', sendLoadMsg); | 1191 instance.listen('load', sendLoadMsg); |
| 1192 } else { | 1192 } else { |
| 1193 sendLoadMsg(); | 1193 sendLoadMsg(); |
| 1194 } | 1194 } |
| 1195 }; | 1195 }; |
| 1196 | 1196 |
| 1197 RPC.prototype._postMessageBacklog = function() { | 1197 RPC.prototype._postMessageBacklog = function() { |
| 1198 if (this._open) { | 1198 if (this._open) { |
| 1199 forEach(this._msgBacklog, this._postMessage, this); | 1199 // forEach(this._msgBacklog, this._postMessage, this); |
| 1200 this._msgBacklog = []; | 1200 // this._msgBacklog = []; |
|
ananta
2009/12/09 01:08:28
Please delete these lines
| |
| 1201 while (this._msgBacklog.length) { | |
| 1202 var msg = this._msgBacklog.shift(); | |
| 1203 this._postMessage(msg); | |
| 1204 } | |
| 1201 } | 1205 } |
| 1202 }; | 1206 }; |
| 1203 | 1207 |
| 1204 RPC.prototype._postMessage = function(msg, force) { | 1208 RPC.prototype._postMessage = function(msg, force) { |
| 1205 if (!force && !this._open) { | 1209 if (!force && !this._open) { |
| 1206 this._msgBacklog.push(msg); | 1210 this._msgBacklog.push(msg); |
| 1207 } else { | 1211 } else { |
| 1208 // FIXME(slightlyoff): need to check domains list here! | 1212 // FIXME(slightlyoff): need to check domains list here! |
| 1209 this.instance.postMessage(msgPrefix + msg, '*'); | 1213 this.instance.postMessage(msgPrefix + msg, '*'); |
| 1210 } | 1214 } |
| 1211 }; | 1215 }; |
| 1212 | 1216 |
| 1213 // currently no-ops. We may need them in the future | |
| 1214 // RPC.prototype._doWithAck_load = function() { }; | |
|
ananta
2009/12/09 01:08:28
Remove?
| |
| 1215 // RPC.prototype._doWithAck_init = function() { }; | |
| 1216 | |
| 1217 RPC.prototype._doWithAck = function(what) { | 1217 RPC.prototype._doWithAck = function(what) { |
| 1218 var f = this['_doWithAck_' + what]; | |
| 1219 if (f) { | |
| 1220 f.call(this); | |
| 1221 } | |
|
ananta
2009/12/09 01:08:28
Ditto
| |
| 1222 | |
| 1223 this._postMessage('doWithAckCallback:' + what, what == 'load'); | 1218 this._postMessage('doWithAckCallback:' + what, what == 'load'); |
| 1224 }; | 1219 }; |
| 1225 | 1220 |
| 1226 RPC.prototype.doWithAck = function(what) { | 1221 RPC.prototype.doWithAck = function(what) { |
| 1227 var d = new Deferred(); | 1222 var d = new Deferred(); |
| 1228 this._doWithAckCallbacks[what] = d; | 1223 this._doWithAckCallbacks[what] = d; |
| 1229 this._postMessage('doWithAck:' + what, what == 'load'); | 1224 this._postMessage('doWithAck:' + what, what == 'load'); |
| 1230 return d; | 1225 return d; |
| 1231 }; | 1226 }; |
| 1232 | 1227 |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1647 CFInstance.fromJson = fromJson; | 1642 CFInstance.fromJson = fromJson; |
| 1648 CFInstance.log = log; | 1643 CFInstance.log = log; |
| 1649 | 1644 |
| 1650 // expose CFInstance to the external scope. We've already checked to make | 1645 // expose CFInstance to the external scope. We've already checked to make |
| 1651 // sure we're not going to blow existing objects away. | 1646 // sure we're not going to blow existing objects away. |
| 1652 scope.CFInstance = CFInstance; | 1647 scope.CFInstance = CFInstance; |
| 1653 | 1648 |
| 1654 })( this['ChromeFrameScope'] || this ); | 1649 })( this['ChromeFrameScope'] || this ); |
| 1655 | 1650 |
| 1656 // vim: shiftwidth=2:et:ai:tabstop=2 | 1651 // vim: shiftwidth=2:et:ai:tabstop=2 |
| OLD | NEW |