Use stricter types in private methods, operate on array directly
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
goog.provide('ol.TilePriorityFunction');
|
goog.provide('ol.TilePriorityFunction');
|
||||||
goog.provide('ol.TileQueue');
|
goog.provide('ol.TileQueue');
|
||||||
|
|
||||||
goog.require('goog.array');
|
|
||||||
goog.require('goog.events');
|
goog.require('goog.events');
|
||||||
goog.require('goog.events.EventType');
|
goog.require('goog.events.EventType');
|
||||||
goog.require('ol.Coordinate');
|
goog.require('ol.Coordinate');
|
||||||
@@ -77,7 +76,7 @@ ol.TileQueue.DROP = Infinity;
|
|||||||
* FIXME empty description for jsdoc
|
* FIXME empty description for jsdoc
|
||||||
*/
|
*/
|
||||||
ol.TileQueue.prototype.clear = function() {
|
ol.TileQueue.prototype.clear = function() {
|
||||||
goog.array.clear(this.heap_);
|
this.heap_.length = 0;
|
||||||
this.queuedTileKeys_ = {};
|
this.queuedTileKeys_ = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -85,17 +84,14 @@ ol.TileQueue.prototype.clear = function() {
|
|||||||
/**
|
/**
|
||||||
* Remove and return the highest-priority tile. O(logn).
|
* Remove and return the highest-priority tile. O(logn).
|
||||||
* @private
|
* @private
|
||||||
* @return {ol.Tile|undefined} Tile.
|
* @return {ol.Tile} Tile.
|
||||||
*/
|
*/
|
||||||
ol.TileQueue.prototype.dequeue_ = function() {
|
ol.TileQueue.prototype.dequeue_ = function() {
|
||||||
var heap = this.heap_;
|
var heap = this.heap_;
|
||||||
var count = heap.length;
|
goog.asserts.assert(heap.length > 0);
|
||||||
if (count <= 0) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
var tile = /** @type {ol.Tile} */ (heap[0][1]);
|
var tile = /** @type {ol.Tile} */ (heap[0][1]);
|
||||||
if (count == 1) {
|
if (heap.length == 1) {
|
||||||
goog.array.clear(heap);
|
heap.length = 0;
|
||||||
} else {
|
} else {
|
||||||
heap[0] = heap.pop();
|
heap[0] = heap.pop();
|
||||||
this.siftUp_(0);
|
this.siftUp_(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user