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 // All of these scripts could be imported with a single call to importScripts, | 7 // All of these scripts could be imported with a single call to importScripts, |
8 // but then load and compile time errors would all be reported from the same | 8 // but then load and compile time errors would all be reported from the same |
9 // line. | 9 // line. |
10 importScripts('metadata_parser.js'); | 10 importScripts('metadata_parser.js'); |
11 importScripts('byte_reader.js'); | 11 importScripts('byte_reader.js'); |
12 importScripts('../util.js'); | 12 importScripts('../../../common/js/util.js'); |
13 | 13 |
14 /** | 14 /** |
15 * Dispatches metadata requests to the correct parser. | 15 * Dispatches metadata requests to the correct parser. |
16 * | 16 * |
17 * @param {Object} port Worker port. | 17 * @param {Object} port Worker port. |
18 * @constructor | 18 * @constructor |
19 */ | 19 */ |
20 function MetadataDispatcher(port) { | 20 function MetadataDispatcher(port) { |
21 this.port_ = port; | 21 this.port_ = port; |
22 this.port_.onmessage = this.onMessage.bind(this); | 22 this.port_.onmessage = this.onMessage.bind(this); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 if (global.constructor.name == 'SharedWorkerGlobalScope') { | 217 if (global.constructor.name == 'SharedWorkerGlobalScope') { |
218 global.addEventListener('connect', function(e) { | 218 global.addEventListener('connect', function(e) { |
219 var port = e.ports[0]; | 219 var port = e.ports[0]; |
220 new MetadataDispatcher(port); | 220 new MetadataDispatcher(port); |
221 port.start(); | 221 port.start(); |
222 }); | 222 }); |
223 } else { | 223 } else { |
224 // Non-shared worker. | 224 // Non-shared worker. |
225 new MetadataDispatcher(global); | 225 new MetadataDispatcher(global); |
226 } | 226 } |
OLD | NEW |