OLD | NEW |
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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * MetadataCache is a map from url to an object containing properties. | 8 * MetadataCache is a map from url to an object containing properties. |
9 * Properties are divided by types, and all properties of one type are accessed | 9 * Properties are divided by types, and all properties of one type are accessed |
10 * at once. | 10 * at once. |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 */ | 857 */ |
858 function ContentProvider() { | 858 function ContentProvider() { |
859 MetadataProvider.call(this); | 859 MetadataProvider.call(this); |
860 | 860 |
861 // Pass all URLs to the metadata reader until we have a correct filter. | 861 // Pass all URLs to the metadata reader until we have a correct filter. |
862 this.urlFilter_ = /.*/; | 862 this.urlFilter_ = /.*/; |
863 | 863 |
864 var path = document.location.pathname; | 864 var path = document.location.pathname; |
865 var workerPath = document.location.origin + | 865 var workerPath = document.location.origin + |
866 path.substring(0, path.lastIndexOf('/') + 1) + | 866 path.substring(0, path.lastIndexOf('/') + 1) + |
867 'js/metadata/metadata_dispatcher.js'; | 867 'foreground/js/metadata/metadata_dispatcher.js'; |
868 | 868 |
869 if (ContentProvider.USE_SHARED_WORKER) { | 869 if (ContentProvider.USE_SHARED_WORKER) { |
870 this.dispatcher_ = new SharedWorker(workerPath).port; | 870 this.dispatcher_ = new SharedWorker(workerPath).port; |
871 this.dispatcher_.start(); | 871 this.dispatcher_.start(); |
872 } else { | 872 } else { |
873 this.dispatcher_ = new Worker(workerPath); | 873 this.dispatcher_ = new Worker(workerPath); |
874 } | 874 } |
875 | 875 |
876 this.dispatcher_.onmessage = this.onMessage_.bind(this); | 876 this.dispatcher_.onmessage = this.onMessage_.bind(this); |
877 this.dispatcher_.postMessage({verb: 'init'}); | 877 this.dispatcher_.postMessage({verb: 'init'}); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 | 1041 |
1042 /** | 1042 /** |
1043 * Handles the 'log' message from the worker. | 1043 * Handles the 'log' message from the worker. |
1044 * @param {Array.<*>} arglist Log arguments. | 1044 * @param {Array.<*>} arglist Log arguments. |
1045 * @private | 1045 * @private |
1046 */ | 1046 */ |
1047 ContentProvider.prototype.onLog_ = function(arglist) { | 1047 ContentProvider.prototype.onLog_ = function(arglist) { |
1048 if (MetadataCache.log) // Avoid log spam by default. | 1048 if (MetadataCache.log) // Avoid log spam by default. |
1049 console.log.apply(console, ['metadata:'].concat(arglist)); | 1049 console.log.apply(console, ['metadata:'].concat(arglist)); |
1050 }; | 1050 }; |
OLD | NEW |