/src/mozilla-central/gfx/layers/composite/PaintCounter.h
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 | | #ifndef mozilla_layers_PaintCounter_h_ |
8 | | #define mozilla_layers_PaintCounter_h_ |
9 | | |
10 | | #include <map> // for std::map |
11 | | #include "mozilla/Maybe.h" |
12 | | #include "mozilla/RefPtr.h" // for already_AddRefed, RefCounted |
13 | | #include "mozilla/TimeStamp.h" // for TimeStamp, TimeDuration |
14 | | #include "skia/include/core/SkCanvas.h" |
15 | | |
16 | | namespace mozilla { |
17 | | namespace layers { |
18 | | |
19 | | class Compositor; |
20 | | |
21 | | using namespace mozilla::gfx; |
22 | | using namespace mozilla::gl; |
23 | | |
24 | | // Keeps track and paints how long a full invalidation paint takes to rasterize |
25 | | // and composite. |
26 | | class PaintCounter { |
27 | | public: |
28 | | NS_INLINE_DECL_THREADSAFE_REFCOUNTING(PaintCounter) |
29 | | |
30 | | PaintCounter(); |
31 | | void Draw(Compositor* aCompositor, TimeDuration aPaintTime, TimeDuration aCompositeTime); |
32 | 0 | static IntRect GetPaintRect() { return PaintCounter::mRect; } |
33 | | |
34 | | private: |
35 | | virtual ~PaintCounter(); |
36 | | |
37 | | SurfaceFormat mFormat; |
38 | | std::unique_ptr<SkCanvas> mCanvas; |
39 | | IntSize mSize; |
40 | | int mStride; |
41 | | |
42 | | RefPtr<DataSourceSurface> mSurface; |
43 | | RefPtr<DataTextureSource> mTextureSource; |
44 | | RefPtr<TexturedEffect> mTexturedEffect; |
45 | | Maybe<DataSourceSurface::ScopedMap> mMap; |
46 | | static IntRect mRect; |
47 | | }; |
48 | | |
49 | | } // namespace layers |
50 | | } // namespace mozilla |
51 | | |
52 | | #endif // mozilla_layers_opengl_PaintCounter_h_ |