Home | History | Annotate | Download | only in chrome
      1 <!DOCTYPE html>
      2 <!--
      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
      5 found in the LICENSE file.
      6 -->
      7 
      8 <link rel="import" href="/tracing/base/event.html">
      9 <link rel="import" href="/tracing/base/iteration_helpers.html">
     10 
     11 <script>
     12 'use strict';
     13 
     14 /**
     15  * @fileoverview Some generic slice titles appear very frequently in traces,
     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
     18  * generate a more useful title.
     19  */
     20 tr.exportTo('tr.e.chrome', function() {
     21   function SliceTitleFixer() {
     22   }
     23 
     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
     26  // using a similar pattern.
     27  SliceTitleFixer.fromEvent = function(event) {
     28     if (event.args && event.args['src_func'])
     29       return event.title + ' <- ' + event.args['src_func'];
     30     return event.title;
     31   };
     32 
     33   return {
     34     SliceTitleFixer: SliceTitleFixer
     35   };
     36 });
     37 
     38