1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 window.pyautoRecordTrace = function(systemTracing) {
7 if( window.timelineModelShimId == undefined )
8 window.timelineModelShimId = 0;
9 if( window.timelineModelShims == undefined )
10 window.timelineModelShims = {};
11 var handler = function() {
12 tracingController.removeEventListener('traceEnded', handler);
13 var model = new TimelineModelShim(
14 Array.prototype.slice.call(arguments, 1)
16 var events = [tracingController.traceEvents_];
17 if (tracingController.supportsSystemTracing)
18 events.push(tracingController.systemTraceEvents_);
19 model.importTraces(events);
20 var shimId = window.timelineModelShimId;
21 window.timelineModelShims[shimId] = model;
22 window.domAutomationController.send(shimId);
23 window.timelineModelShimId++;
25 tracingController.addEventListener('traceEnded', handler);
27 tracingController.supportsSystemTracing ? systemTracing : false;
28 tracingController.beginTracing(willSystemTrace);
29 return willSystemTrace;
32 // This causes the PyAuto ExecuteJavascript call which executed this file to
34 window.domAutomationController.send('');