OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2013 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 | 7 |
8 <link rel="import" href="/tracing/base/in_memory_trace_stream.html"> | 8 <link rel="import" href="/tracing/base/in_memory_trace_stream.html"> |
9 <link rel="import" href="/tracing/extras/importer/jszip.html"> | 9 <link rel="import" href="/tracing/extras/importer/jszip.html"> |
10 <link rel="import" href="/tracing/importer/importer.html"> | 10 <link rel="import" href="/tracing/importer/importer.html"> |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 if (haveHeaderCrc) getWord(); | 126 if (haveHeaderCrc) getWord(); |
127 | 127 |
128 // Inflate the data using jszip. | 128 // Inflate the data using jszip. |
129 const inflatedData = | 129 const inflatedData = |
130 JSZip.compressions.DEFLATE.uncompress(data.subarray(position)); | 130 JSZip.compressions.DEFLATE.uncompress(data.subarray(position)); |
131 | 131 |
132 if (this.inflateAsTraceStream_) { | 132 if (this.inflateAsTraceStream_) { |
133 return GzipImporter.transformToStream(inflatedData); | 133 return GzipImporter.transformToStream(inflatedData); |
134 } | 134 } |
135 | 135 |
136 const string = GzipImporter.transformToString(inflatedData); | 136 let string; |
| 137 try { |
| 138 string = GzipImporter.transformToString(inflatedData); |
| 139 } catch (err) { |
| 140 // It may be the case that inflated data does not fit into a V8 string. In |
| 141 // that case, try to transform to a trace stream. |
| 142 return GzipImporter.transformToStream(inflatedData); |
| 143 } |
137 | 144 |
138 if (inflatedData.length > 0 && string.length === 0) { | 145 if (inflatedData.length > 0 && string.length === 0) { |
139 throw new RangeError('Inflated gzip data too long to fit into a string' + | 146 throw new RangeError('Inflated gzip data too long to fit into a string' + |
140 ' (' + inflatedData.length + ').'); | 147 ' (' + inflatedData.length + ').'); |
141 } | 148 } |
142 | 149 |
143 return string; | 150 return string; |
144 }; | 151 }; |
145 | 152 |
146 GzipImporter.transformToStream = function(data) { | 153 GzipImporter.transformToStream = function(data) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 } | 211 } |
205 }; | 212 }; |
206 | 213 |
207 tr.importer.Importer.register(GzipImporter); | 214 tr.importer.Importer.register(GzipImporter); |
208 | 215 |
209 return { | 216 return { |
210 GzipImporter, | 217 GzipImporter, |
211 }; | 218 }; |
212 }); | 219 }); |
213 </script> | 220 </script> |
OLD | NEW |