summaryrefslogtreecommitdiff
path: root/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_gpu_helper.html
blob: 0683fde1b535276806f9d8798809844c61f7d953 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE html>
<!--
Copyright (c) 2015 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="/tracing/model/helpers/chrome_process_helper.html">

<script>
'use strict';

/**
 * @fileoverview Utilities for accessing the Chrome GPU Process.
 */
tr.exportTo('tr.model.helpers', function() {
  function ChromeGpuHelper(modelHelper, process) {
    tr.model.helpers.ChromeProcessHelper.call(this, modelHelper, process);
    this.mainThread_ = process.findAtMostOneThreadNamed('CrGpuMain');
    if (!process.name)
      process.name = ChromeGpuHelper.PROCESS_NAME;
  };

  ChromeGpuHelper.PROCESS_NAME = 'GPU Process';

  ChromeGpuHelper.isGpuProcess = function(process) {
    // In some android builds the GPU thread is not in a separate process.
    if (process.findAtMostOneThreadNamed('CrBrowserMain') ||
        process.findAtMostOneThreadNamed('CrRendererMain'))
      return false;
    return process.findAtMostOneThreadNamed('CrGpuMain');
  };

  ChromeGpuHelper.prototype = {
    __proto__: tr.model.helpers.ChromeProcessHelper.prototype,

    get mainThread() {
      return this.mainThread_;
    }
  };

  return {
    ChromeGpuHelper: ChromeGpuHelper
  };
});
</script>