Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/gfx/layers/mlgpu/MemoryReportingMLGPU.cpp
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#include "MemoryReportingMLGPU.h"
8
#include "nsIMemoryReporter.h"
9
10
namespace mozilla {
11
namespace layers {
12
namespace mlg {
13
14
mozilla::Atomic<size_t> sConstantBufferUsage;
15
mozilla::Atomic<size_t> sVertexBufferUsage;
16
mozilla::Atomic<size_t> sRenderTargetUsage;
17
18
class MemoryReportingMLGPU final : public nsIMemoryReporter
19
{
20
public:
21
  NS_DECL_ISUPPORTS
22
23
  NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
24
                            nsISupports* aData,
25
                            bool aAnonymize) override
26
0
  {
27
0
    if (sConstantBufferUsage) {
28
0
      MOZ_COLLECT_REPORT(
29
0
        "mlgpu-constant-buffers", KIND_OTHER, UNITS_BYTES,
30
0
        sConstantBufferUsage,
31
0
        "Advanced Layers shader constant buffers.");
32
0
    }
33
0
    if (sVertexBufferUsage) {
34
0
      MOZ_COLLECT_REPORT(
35
0
        "mlgpu-vertex-buffers", KIND_OTHER, UNITS_BYTES,
36
0
        sVertexBufferUsage,
37
0
        "Advanced Layers shader vertex buffers.");
38
0
    }
39
0
    if (sRenderTargetUsage) {
40
0
      MOZ_COLLECT_REPORT(
41
0
        "mlgpu-render-targets", KIND_OTHER, UNITS_BYTES,
42
0
        sRenderTargetUsage,
43
0
        "Advanced Layers render target textures and depth buffers.");
44
0
    }
45
0
    return NS_OK;
46
0
  }
47
48
private:
49
0
  ~MemoryReportingMLGPU() {}
50
};
51
52
NS_IMPL_ISUPPORTS(MemoryReportingMLGPU, nsIMemoryReporter);
53
54
void
55
InitializeMemoryReporters()
56
0
{
57
0
  RegisterStrongMemoryReporter(new MemoryReportingMLGPU());
58
0
}
59
60
} // namespace mlg
61
} // namespace layers
62
} // namespace mozilla