62045a4590
This version of the Timeline allows the developer to see a logical view over the operations involved in each frame. Events are grouped by frame and shifted accordingly to avoid to have overlapped frame. See runtime/observatory/web/timeline.js for the undestrand the steps involded in the process. Change-Id: I3980a3278a32fe69ed70db07cfa7189dc0c9a643 Reviewed-on: https://dart-review.googlesource.com/5603 Commit-Queue: Carlo Bernaschina <cbernaschina@google.com> Reviewed-by: Todd Turnidge <turnidge@google.com>
55 lines
1.5 KiB
JavaScript
55 lines
1.5 KiB
JavaScript
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
|
|
// 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.
|
|
|
|
// This file is loaded before the about:tracing code is loaded so that we have
|
|
// an event listener registered early.
|
|
|
|
// 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);
|
|
window.addEventListener("hashchange", onHashChange, false);
|
|
}
|
|
|
|
registerForMessages();
|
|
|
|
function onMessage(event) {
|
|
var request = JSON.parse(event.data);
|
|
var method = request['method'];
|
|
var params = request['params'];
|
|
console.log('method: ' + method)
|
|
switch (method) {
|
|
case 'refresh':
|
|
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();
|
|
break;
|
|
case 'save':
|
|
saveTimeline();
|
|
break;
|
|
case 'load':
|
|
loadTimeline();
|
|
break;
|
|
default:
|
|
console.log('Unknown method:' + method + '.');
|
|
}
|
|
}
|
|
|
|
function onHashChange() {
|
|
refreshTimeline();
|
|
}
|
|
|
|
console.log('message handler registered');
|