| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright (c) 2015 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
| 5 found in the LICENSE file. | 5 found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 | 7 |
| 8 <link rel="import" href="/tracing/base/event.html"> | 8 <link rel="import" href="/tracing/base/event.html"> |
| 9 <link rel="import" href="/tracing/base/iteration_helpers.html"> | 9 <link rel="import" href="/tracing/base/utils.html"> |
| 10 | 10 |
| 11 <script> | 11 <script> |
| 12 'use strict'; | 12 'use strict'; |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * @fileoverview Some generic slice titles appear very frequently in traces, | 15 * @fileoverview Some generic slice titles appear very frequently in traces, |
| 16 * like MessageLoop::RunTask. Some of these slices have arguments that give | 16 * like MessageLoop::RunTask. Some of these slices have arguments that give |
| 17 * useful context. This class combine such arguments with the slice title to | 17 * useful context. This class combine such arguments with the slice title to |
| 18 * generate a more useful title. | 18 * generate a more useful title. |
| 19 */ | 19 */ |
| 20 tr.exportTo('tr.e.chrome', function() { | 20 tr.exportTo('tr.e.chrome', function() { |
| 21 function SliceTitleFixer() { | 21 function SliceTitleFixer() { |
| 22 } | 22 } |
| 23 | 23 |
| 24 // AsyncSlice uses virtual functions to accomplish something similar to what | 24 // AsyncSlice uses virtual functions to accomplish something similar to what |
| 25 // we're doing here. If this function ever becomes too complex we may consider | 25 // we're doing here. If this function ever becomes too complex we may consider |
| 26 // using a similar pattern. | 26 // using a similar pattern. |
| 27 SliceTitleFixer.fromEvent = function(event) { | 27 SliceTitleFixer.fromEvent = function(event) { |
| 28 if (event.args && event.args.src_func) { | 28 if (event.args && event.args.src_func) { |
| 29 return event.title + ' <- ' + event.args.src_func; | 29 return event.title + ' <- ' + event.args.src_func; |
| 30 } | 30 } |
| 31 return event.title; | 31 return event.title; |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 return { | 34 return { |
| 35 SliceTitleFixer, | 35 SliceTitleFixer, |
| 36 }; | 36 }; |
| 37 }); | 37 }); |
| 38 </script> | 38 </script> |
| OLD | NEW |