Commit 714c0fd1 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[heap-stats] Fix trace file reader for raw log files

Tbr: cbruni@chromium.org
No-try: true
Change-Id: Ica8c64e0956d4ca362646814e675104f94e77fac
Reviewed-on: https://chromium-review.googlesource.com/1155585Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54791}
parent 0640fd58
...@@ -80,7 +80,16 @@ class TraceFileReader extends HTMLElement { ...@@ -80,7 +80,16 @@ class TraceFileReader extends HTMLElement {
// Delay the loading a bit to allow for CSS animations to happen. // Delay the loading a bit to allow for CSS animations to happen.
setTimeout(() => reader.readAsArrayBuffer(file), 10); setTimeout(() => reader.readAsArrayBuffer(file), 10);
} else { } else {
reader.onload = (e) => this.processRawText(file, e.target.result); reader.onload = (e) => {
try {
this.processRawText(file, e.target.result);
this.section.className = 'success';
this.$('#fileReader').classList.add('done');
} catch (err) {
console.error(err);
this.section.className = 'failure';
}
};
setTimeout(() => reader.readAsText(file), 10); setTimeout(() => reader.readAsText(file), 10);
} }
} }
...@@ -240,7 +249,7 @@ class TraceFileReader extends HTMLElement { ...@@ -240,7 +249,7 @@ class TraceFileReader extends HTMLElement {
line = line.replace(/^I\/v8\s*\(\d+\):\s+/g, ''); line = line.replace(/^I\/v8\s*\(\d+\):\s+/g, '');
return JSON.parse(line); return JSON.parse(line);
} catch (e) { } catch (e) {
console.log('Unable to parse line: \'' + line + '\'\' (' + e + ')'); console.log('Unable to parse line: \'' + line + '\' (' + e + ')');
} }
return null; return null;
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment