db07faaa8c
- [x] Remove Stop / Start buttons and replace with fine grained category control. - [x] Restrict the cpu profile to the time span of the timeline. - [x] Display recorder name. - [x] Show a popup when fetching the timeline from the VM. - [x] Show a popup when fetching the cpu profile(s) from the VM. Fixes #26401 Fixes #26394 BUG= R=rmacnak@google.com Review URL: https://codereview.chromium.org/1972523003 .
50 lines
1.4 KiB
JavaScript
50 lines
1.4 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);
|
|
}
|
|
|
|
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 + '.');
|
|
}
|
|
}
|
|
|
|
console.log('message handler registered');
|