Merge pull request #2630 from fredj/misc

Improve ol.structs.LRUCache type annotation
This commit is contained in:
Frédéric Junod
2014-08-28 13:59:30 +02:00
2 changed files with 7 additions and 8 deletions

View File

@@ -107,7 +107,7 @@ ol.renderer.webgl.Map = function(container, map) {
/**
* @private
* @type {ol.structs.LRUCache}
* @type {ol.structs.LRUCache.<ol.renderer.webgl.TextureCacheEntry|null>}
*/
this.textureCache_ = new ol.structs.LRUCache();
@@ -141,7 +141,7 @@ ol.renderer.webgl.Map = function(container, map) {
Math.sqrt(deltaX * deltaX + deltaY * deltaY) / tileResolution;
}, this),
/**
* @param {Array} element Element.
* @param {Array.<*>} element Element.
* @return {string} Key.
*/
function(element) {
@@ -189,8 +189,8 @@ ol.renderer.webgl.Map.prototype.bindTileTexture =
var gl = this.getGL();
var tileKey = tile.getKey();
if (this.textureCache_.containsKey(tileKey)) {
var textureCacheEntry = /** @type {ol.renderer.webgl.TextureCacheEntry} */
(this.textureCache_.get(tileKey));
var textureCacheEntry = this.textureCache_.get(tileKey);
goog.asserts.assert(!goog.isNull(textureCacheEntry));
gl.bindTexture(goog.webgl.TEXTURE_2D, textureCacheEntry.texture);
if (textureCacheEntry.magFilter != magFilter) {
gl.texParameteri(
@@ -283,7 +283,7 @@ ol.renderer.webgl.Map.prototype.disposeInternal = function() {
if (!gl.isContextLost()) {
this.textureCache_.forEach(
/**
* @param {ol.renderer.webgl.TextureCacheEntry} textureCacheEntry
* @param {?ol.renderer.webgl.TextureCacheEntry} textureCacheEntry
* Texture cache entry.
*/
function(textureCacheEntry) {
@@ -307,8 +307,7 @@ ol.renderer.webgl.Map.prototype.expireCache_ = function(map, frameState) {
var textureCacheEntry;
while (this.textureCache_.getCount() - this.textureCacheFrameMarkerCount_ >
ol.WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK) {
textureCacheEntry = /** @type {?ol.renderer.webgl.TextureCacheEntry} */
(this.textureCache_.peekLast());
textureCacheEntry = this.textureCache_.peekLast();
if (goog.isNull(textureCacheEntry)) {
if (+this.textureCache_.peekLastKey() == frameState.index) {
break;

View File

@@ -162,7 +162,7 @@ ol.structs.LRUCache.prototype.getKeys = function() {
/**
* @return {Array} Values.
* @return {Array.<T>} Values.
*/
ol.structs.LRUCache.prototype.getValues = function() {
var values = new Array(this.count_);