1<!DOCTYPE html>
2<!--
3Copyright (c) 2014 The Chromium Authors. All rights reserved.
4Use of this source code is governed by a BSD-style license that can be
5found in the LICENSE file.
6-->
7<link rel="import" href="/tracing/model/helpers/chrome_process_helper.html">
8
9<script>
10'use strict';
11
12/**
13 * @fileoverview Utilities for accessing trace data about the Chrome browser.
14 */
15tr.exportTo('tr.model.helpers', function() {
16  function ChromeRendererHelper(modelHelper, process) {
17    tr.model.helpers.ChromeProcessHelper.call(this, modelHelper, process);
18    this.mainThread_ = process.findAtMostOneThreadNamed('CrRendererMain');
19    this.compositorThread_ = process.findAtMostOneThreadNamed('Compositor');
20    this.rasterWorkerThreads_ = process.findAllThreadsMatching(function(t) {
21      if (t.name === undefined)
22        return false;
23      if (t.name.indexOf('CompositorTileWorker') === 0)
24        return true;
25      if (t.name.indexOf('CompositorRasterWorker') === 0)
26        return true;
27      return false;
28    });
29  };
30
31  ChromeRendererHelper.isRenderProcess = function(process) {
32    if (!process.findAtMostOneThreadNamed('CrRendererMain'))
33      return false;
34    if (!process.findAtMostOneThreadNamed('Compositor'))
35      return false;
36    return true;
37  };
38
39  ChromeRendererHelper.prototype = {
40    __proto__: tr.model.helpers.ChromeProcessHelper.prototype,
41
42    get mainThread() {
43      return this.mainThread_;
44    },
45
46    get compositorThread() {
47      return this.compositorThread_;
48    },
49
50    get rasterWorkerThreads() {
51      return this.rasterWorkerThreads_;
52    }
53  };
54
55  return {
56    ChromeRendererHelper: ChromeRendererHelper
57  };
58});
59</script>
60