OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 var sourceMapping = new WebInspector.FormatterSourceMappingImpl(original
Content.lineEndings(), formattedContent.lineEndings(), mapping); | 117 var sourceMapping = new WebInspector.FormatterSourceMappingImpl(original
Content.lineEndings(), formattedContent.lineEndings(), mapping); |
118 task.callback(formattedContent, sourceMapping); | 118 task.callback(formattedContent, sourceMapping); |
119 }, | 119 }, |
120 | 120 |
121 /** | 121 /** |
122 * @return {!Worker} | 122 * @return {!Worker} |
123 */ | 123 */ |
124 get _worker() | 124 get _worker() |
125 { | 125 { |
126 if (!this._cachedWorker) { | 126 if (!this._cachedWorker) { |
127 this._cachedWorker = new Worker("script_formatter_worker/ScriptForma
tterWorker.js"); | 127 this._cachedWorker = Runtime.startWorker("script_formatter_worker"); |
128 this._cachedWorker.onmessage = /** @type {function(this:Worker)} */
(this._didFormatContent.bind(this)); | 128 this._cachedWorker.onmessage = /** @type {function(this:Worker)} */
(this._didFormatContent.bind(this)); |
129 } | 129 } |
130 return this._cachedWorker; | 130 return this._cachedWorker; |
131 } | 131 } |
132 } | 132 } |
133 | 133 |
134 /** | 134 /** |
135 * @constructor | 135 * @constructor |
136 * @implements {WebInspector.Formatter} | 136 * @implements {WebInspector.Formatter} |
137 */ | 137 */ |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 */ | 261 */ |
262 _convertPosition: function(positions1, positions2, position) | 262 _convertPosition: function(positions1, positions2, position) |
263 { | 263 { |
264 var index = positions1.upperBound(position) - 1; | 264 var index = positions1.upperBound(position) - 1; |
265 var convertedPosition = positions2[index] + position - positions1[index]
; | 265 var convertedPosition = positions2[index] + position - positions1[index]
; |
266 if (index < positions2.length - 1 && convertedPosition > positions2[inde
x + 1]) | 266 if (index < positions2.length - 1 && convertedPosition > positions2[inde
x + 1]) |
267 convertedPosition = positions2[index + 1]; | 267 convertedPosition = positions2[index + 1]; |
268 return convertedPosition; | 268 return convertedPosition; |
269 } | 269 } |
270 } | 270 } |
OLD | NEW |