Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1615)

Unified Diff: runtime/observatory/web/timeline.js

Issue 1847043003: Automatically fetch timeline when timeline page is loaded (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/observatory/lib/src/elements/timeline_page.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/web/timeline.js
diff --git a/runtime/observatory/web/timeline.js b/runtime/observatory/web/timeline.js
index 402723d7fe298b57656da03de46aacf36abccc07..dea55429fd438ec257c1971eaa788b4d55cde500 100644
--- a/runtime/observatory/web/timeline.js
+++ b/runtime/observatory/web/timeline.js
@@ -2,6 +2,18 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// Used to delay the initial timeline load until the timeline has finished
+// loading.
+timeline_loaded = false;
+timeline_vm_address = undefined;
+timeline_isolates = undefined;
+
+function registerForMessages() {
+ window.addEventListener("message", onMessage, false);
+}
+
+registerForMessages();
+
function onModelLoaded() {
viewer.globalMode = true;
viewer.model = model;
@@ -26,9 +38,7 @@ function updateTimeline(events) {
p.then(onModelLoaded, onImportFail);
}
-function registerForMessages() {
- window.addEventListener("message", onMessage, false);
-}
+
function fetchUri(uri, onLoad, onError) {
var xhr = new XMLHttpRequest();
@@ -196,7 +206,13 @@ function onMessage(event) {
var params = request['params'];
switch (method) {
case 'refresh':
- fetchTimeline(params['vmAddress'], params['isolateIds']);
+ if (!timeline_loaded) {
+ timeline_vm_address = params['vmAddress'];
+ timeline_isolates = params['isolateIds'];
+ console.log('Delaying timeline refresh until loaded.');
+ } else {
+ fetchTimeline(params['vmAddress'], params['isolateIds']);
+ }
break;
case 'clear':
clearTimeline();
@@ -221,7 +237,13 @@ document.addEventListener('DOMContentLoaded', function() {
viewer.id = 'trace-viewer';
viewer.globalMode = true;
document.body.appendChild(viewer);
- registerForMessages();
+ timeline_loaded = true;
+ if (timeline_vm_address != undefined) {
+ console.log('Triggering delayed timeline refresh.');
+ fetchTimeline(timeline_vm_address, timeline_isolates);
+ timeline_vm_address = undefined;
+ timeline_isolates = undefined;
+ }
});
console.log('loaded');
« no previous file with comments | « runtime/observatory/lib/src/elements/timeline_page.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698