Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: ui/file_manager/image_loader/cache.js

Issue 274473004: Nitpicking fixes for Files.app code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/file_manager/gallery/js/mosaic_mode.js ('k') | ui/file_manager/image_loader/image_loader.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 * Persistent cache storing images in an indexed database on the hard disk. 8 * Persistent cache storing images in an indexed database on the hard disk.
9 * @constructor 9 * @constructor
10 */ 10 */
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 var dataEntry = null; 277 var dataEntry = null;
278 var dataReceived = false; 278 var dataReceived = false;
279 279
280 var onPartialSuccess = function() { 280 var onPartialSuccess = function() {
281 // Check if all sub-requests have finished. 281 // Check if all sub-requests have finished.
282 if (!metadataReceived || !dataReceived) 282 if (!metadataReceived || !dataReceived)
283 return; 283 return;
284 284
285 // Check if both entries are available or both unavailable. 285 // Check if both entries are available or both unavailable.
286 if (!!metadataEntry != !!dataEntry) { 286 if (!!metadataEntry != !!dataEntry) {
287 console.warn('Incosistent cache database.'); 287 console.warn('Inconsistent cache database.');
288 onFailure(); 288 onFailure();
289 return; 289 return;
290 } 290 }
291 291
292 // Process the responses. 292 // Process the responses.
293 if (!metadataEntry) { 293 if (!metadataEntry) {
294 // The image not found. 294 // The image not found.
295 onFailure(); 295 onFailure();
296 } else if (metadataEntry.timestamp != timestamp) { 296 } else if (metadataEntry.timestamp != timestamp) {
297 // The image is not up to date, so remove it. 297 // The image is not up to date, so remove it.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 metadataReceived = true; 401 metadataReceived = true;
402 onPartialSuccess(); 402 onPartialSuccess();
403 }; 403 };
404 404
405 metadataRequest.onerror = function() { 405 metadataRequest.onerror = function() {
406 console.error('Failed to remove an image.'); 406 console.error('Failed to remove an image.');
407 metadataReceived = true; 407 metadataReceived = true;
408 onPartialSuccess(); 408 onPartialSuccess();
409 }; 409 };
410 }; 410 };
OLDNEW
« no previous file with comments | « ui/file_manager/gallery/js/mosaic_mode.js ('k') | ui/file_manager/image_loader/image_loader.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698