OLD | NEW |
| (Empty) |
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. | |
4 | |
5 window.pyautoRecordTrace = function(systemTracing) { | |
6 'use strict'; | |
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) | |
15 ); | |
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++; | |
24 }; | |
25 tracingController.addEventListener('traceEnded', handler); | |
26 var willSystemTrace = | |
27 tracingController.supportsSystemTracing ? systemTracing : false; | |
28 tracingController.beginTracing(willSystemTrace); | |
29 return willSystemTrace; | |
30 }; | |
31 | |
32 // This causes the PyAuto ExecuteJavascript call which executed this file to | |
33 // return. | |
34 window.domAutomationController.send(''); | |
OLD | NEW |