OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Webworker spec says that the worker global object is called self. That's | 5 // Webworker spec says that the worker global object is called self. That's |
6 // a terrible name since we use it all over the chrome codebase to capture | 6 // a terrible name since we use it all over the chrome codebase to capture |
7 // the 'this' keyword in lambdas. | 7 // the 'this' keyword in lambdas. |
8 var global = self; | 8 var global = self; |
9 | 9 |
10 // All of these scripts could be imported with a single call to importScripts, | 10 // All of these scripts could be imported with a single call to importScripts, |
11 // but then load and compile time errors would all be reported from the same | 11 // but then load and compile time errors would all be reported from the same |
12 // line. | 12 // line. |
13 importScripts('metadata_parser.js'); | 13 importScripts('metadata_parser.js'); |
14 importScripts('byte_reader.js'); | 14 importScripts('byte_reader.js'); |
15 | 15 |
16 /** | 16 /** |
17 * Dispatches metadata requests to the correct parser. | 17 * Dispatches metadata requests to the correct parser. |
18 */ | 18 */ |
19 function MetadataDispatcher() { | 19 function MetadataDispatcher() { |
| 20 // Make sure to ipdate component_extension_resources.grd |
| 21 // when adding new parsers. |
20 importScripts('exif_parser.js'); | 22 importScripts('exif_parser.js'); |
21 // importScripts('image_parsers.js'); | 23 importScripts('image_parsers.js'); |
22 // The line above is commented out because it caused some browser tests | |
23 // to fail. This is likely to be caused by crbug.com/101665. | |
24 // TODO(kaznacheev) wait until is gets resoved and rerun tests. | |
25 importScripts('mpeg_parser.js'); | 24 importScripts('mpeg_parser.js'); |
26 importScripts('id3_parser.js'); | 25 importScripts('id3_parser.js'); |
27 | 26 |
28 var patterns = ['blob:']; // We use blob urls in gallery_demo.js | 27 var patterns = ['blob:']; // We use blob urls in gallery_demo.js |
29 | 28 |
30 for (var i = 0; i < MetadataDispatcher.parserClasses_.length; i++) { | 29 for (var i = 0; i < MetadataDispatcher.parserClasses_.length; i++) { |
31 var parserClass = MetadataDispatcher.parserClasses_[i]; | 30 var parserClass = MetadataDispatcher.parserClasses_[i]; |
32 var parser = new parserClass(this); | 31 var parser = new parserClass(this); |
33 this.log('new parser: ' + parser.type); | 32 this.log('new parser: ' + parser.type); |
34 this.parserInstances_.push(parser); | 33 this.parserInstances_.push(parser); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // Reuse the last step from the standard sequence. | 203 // Reuse the last step from the standard sequence. |
205 steps[steps.length - 1] | 204 steps[steps.length - 1] |
206 ]; | 205 ]; |
207 } | 206 } |
208 | 207 |
209 nextStep(); | 208 nextStep(); |
210 }; | 209 }; |
211 | 210 |
212 var dispatcher = new MetadataDispatcher(); | 211 var dispatcher = new MetadataDispatcher(); |
213 global.onmessage = dispatcher.onMessage.bind(dispatcher); | 212 global.onmessage = dispatcher.onMessage.bind(dispatcher); |
OLD | NEW |