OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * Called from the main frame when unloading. | 8 * Called from the main frame when unloading. |
9 * @param {boolean=} opt_exiting True if the app is exiting. | 9 * @param {boolean=} opt_exiting True if the app is exiting. |
10 */ | 10 */ |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 161 |
162 // Evict caches. | 162 // Evict caches. |
163 var contentCacheCount = 0; | 163 var contentCacheCount = 0; |
164 var screenCacheCount = 0; | 164 var screenCacheCount = 0; |
165 for (var i = 0; i < sorted.length; i++) { | 165 for (var i = 0; i < sorted.length; i++) { |
166 if (sorted[i].contentImage) { | 166 if (sorted[i].contentImage) { |
167 if (++contentCacheCount > GalleryDataModel.MAX_FULL_IMAGE_CACHE_) { | 167 if (++contentCacheCount > GalleryDataModel.MAX_FULL_IMAGE_CACHE_) { |
168 if (sorted[i].contentImage.parentNode) { | 168 if (sorted[i].contentImage.parentNode) { |
169 console.error('The content image has a parent node.'); | 169 console.error('The content image has a parent node.'); |
170 } else { | 170 } else { |
171 // Force to free the buffer of the canvas by assinng zero size. | 171 // Force to free the buffer of the canvas by assigning zero size. |
172 sorted[i].contentImage.width = 0; | 172 sorted[i].contentImage.width = 0; |
173 sorted[i].contentImage.height = 0; | 173 sorted[i].contentImage.height = 0; |
174 sorted[i].contentImage = null; | 174 sorted[i].contentImage = null; |
175 } | 175 } |
176 } | 176 } |
177 } | 177 } |
178 if (sorted[i].screenImage) { | 178 if (sorted[i].screenImage) { |
179 if (++screenCacheCount > GalleryDataModel.MAX_SCREEN_IMAGE_CACHE_) { | 179 if (++screenCacheCount > GalleryDataModel.MAX_SCREEN_IMAGE_CACHE_) { |
180 if (sorted[i].screenImage.parentNode) { | 180 if (sorted[i].screenImage.parentNode) { |
181 console.error('The screen image has a parent node.'); | 181 console.error('The screen image has a parent node.'); |
182 } else { | 182 } else { |
183 // Force to free the buffer of the canvas by assinng zero size. | 183 // Force to free the buffer of the canvas by assigning zero size. |
184 sorted[i].screenImage.width = 0; | 184 sorted[i].screenImage.width = 0; |
185 sorted[i].screenImage.height = 0; | 185 sorted[i].screenImage.height = 0; |
186 sorted[i].screenImage = null; | 186 sorted[i].screenImage = null; |
187 } | 187 } |
188 } | 188 } |
189 } | 189 } |
190 } | 190 } |
191 }; | 191 }; |
192 | 192 |
193 /** | 193 /** |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 244 |
245 /** | 245 /** |
246 * First time tools fade-out timeout in milliseconds. | 246 * First time tools fade-out timeout in milliseconds. |
247 * @const | 247 * @const |
248 * @type {number} | 248 * @type {number} |
249 */ | 249 */ |
250 Gallery.FIRST_FADE_TIMEOUT = 1000; | 250 Gallery.FIRST_FADE_TIMEOUT = 1000; |
251 | 251 |
252 /** | 252 /** |
253 * Time until mosaic is initialized in the background. Used to make gallery | 253 * Time until mosaic is initialized in the background. Used to make gallery |
254 * in the slide mode load faster. In miiliseconds. | 254 * in the slide mode load faster. In milliseconds. |
255 * @const | 255 * @const |
256 * @type {number} | 256 * @type {number} |
257 */ | 257 */ |
258 Gallery.MOSAIC_BACKGROUND_INIT_DELAY = 1000; | 258 Gallery.MOSAIC_BACKGROUND_INIT_DELAY = 1000; |
259 | 259 |
260 /** | 260 /** |
261 * Types of metadata Gallery uses (to query the metadata cache). | 261 * Types of metadata Gallery uses (to query the metadata cache). |
262 * @const | 262 * @const |
263 * @type {string} | 263 * @type {string} |
264 */ | 264 */ |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 window.loadTimeData.data = backgroundComponents.stringData; | 941 window.loadTimeData.data = backgroundComponents.stringData; |
942 gallery = new Gallery(backgroundComponents.volumeManager); | 942 gallery = new Gallery(backgroundComponents.volumeManager); |
943 }; | 943 }; |
944 | 944 |
945 /** | 945 /** |
946 * Loads entries. | 946 * Loads entries. |
947 */ | 947 */ |
948 window.loadEntries = function(entries, selectedEntries) { | 948 window.loadEntries = function(entries, selectedEntries) { |
949 gallery.load(entries, selectedEntries); | 949 gallery.load(entries, selectedEntries); |
950 }; | 950 }; |
OLD | NEW |