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

Side by Side Diff: chrome/browser/resources/file_manager/js/metadata/metadata_provider.js

Issue 10384155: [filemanager] Content metadata moved to the cache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Bug Created 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 /** 5 /**
6 * A base class for metadata provider. Implementing in-memory caching. 6 * A base class for metadata provider. Implementing in-memory caching.
7 */ 7 */
8 function MetadataCache() { 8 function MetadataCache() {
9 this.cache_ = {}; 9 this.cache_ = {};
10 } 10 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 } 172 }
173 173
174 this[methodName].apply(this, data.arguments); 174 this[methodName].apply(this, data.arguments);
175 }; 175 };
176 176
177 /** 177 /**
178 * Handles the 'initialized' message from the metadata reader Worker. 178 * Handles the 'initialized' message from the metadata reader Worker.
179 */ 179 */
180 LocalMetadataFetcher.prototype.onInitialized_ = function(regexp) { 180 LocalMetadataFetcher.prototype.onInitialized_ = function(regexp) {
181 this.urlFilter = regexp; 181 this.urlFilter = regexp;
182
183 // Tests can monitor for this state with
184 // ExtensionTestMessageListener listener("worker-initialized");
185 // ASSERT_TRUE(listener.WaitUntilSatisfied());
186 // Automated tests need to wait for this, otherwise we crash in
187 // browser_test cleanup because the worker process still has
188 // URL requests in-flight.
189 chrome.test.sendMessage('worker-initialized');
190 this.initialized_ = true; 182 this.initialized_ = true;
191 }; 183 };
192 184
193 LocalMetadataFetcher.prototype.onResult_ = function(url, metadata) { 185 LocalMetadataFetcher.prototype.onResult_ = function(url, metadata) {
194 this.processResult(url, metadata); 186 this.processResult(url, metadata);
195 }; 187 };
196 188
197 LocalMetadataFetcher.prototype.onError_ = function(url, step, error, metadata) { 189 LocalMetadataFetcher.prototype.onError_ = function(url, step, error, metadata) {
198 console.warn('metadata: ' + url + ': ' + step + ': ' + error); 190 console.warn('metadata: ' + url + ': ' + step + ': ' + error);
199 this.processResult(url, metadata || {}); 191 this.processResult(url, metadata || {});
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 MetadataProvider.prototype.fetchLocal = function(url, callback) { 273 MetadataProvider.prototype.fetchLocal = function(url, callback) {
282 this.fetch(url, function(metadata) { 274 this.fetch(url, function(metadata) {
283 if (metadata.remote) { 275 if (metadata.remote) {
284 delete metadata.remote; 276 delete metadata.remote;
285 this.fetch(url, callback, [this.local_]); 277 this.fetch(url, callback, [this.local_]);
286 } else { 278 } else {
287 callback(metadata); 279 callback(metadata);
288 } 280 }
289 }.bind(this)); 281 }.bind(this));
290 }; 282 };
OLDNEW
« no previous file with comments | « chrome/browser/resources/file_manager/js/metadata/metadata_cache.js ('k') | chrome/browser/resources/file_manager/main.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698