Line data Source code
1 : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 : * This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #ifndef mozilla_layers_PaintCounter_h_
7 : #define mozilla_layers_PaintCounter_h_
8 :
9 : #include <map> // for std::map
10 : #include "mozilla/RefPtr.h" // for already_AddRefed, RefCounted
11 : #include "mozilla/TimeStamp.h" // for TimeStamp, TimeDuration
12 : #include "skia/include/core/SkCanvas.h"
13 :
14 : namespace mozilla {
15 : namespace layers {
16 :
17 : class Compositor;
18 :
19 : using namespace mozilla::gfx;
20 : using namespace mozilla::gl;
21 :
22 : // Keeps track and paints how long a full invalidation paint takes to rasterize
23 : // and composite.
24 : class PaintCounter {
25 : public:
26 0 : NS_INLINE_DECL_THREADSAFE_REFCOUNTING(PaintCounter)
27 :
28 : PaintCounter();
29 : void Draw(Compositor* aCompositor, TimeDuration aPaintTime, TimeDuration aCompositeTime);
30 0 : static IntRect GetPaintRect() { return PaintCounter::mRect; }
31 :
32 : private:
33 : virtual ~PaintCounter();
34 :
35 : SurfaceFormat mFormat;
36 : std::unique_ptr<SkCanvas> mCanvas;
37 : IntSize mSize;
38 : int mStride;
39 :
40 : RefPtr<DataSourceSurface> mSurface;
41 : RefPtr<DataTextureSource> mTextureSource;
42 : RefPtr<TexturedEffect> mTexturedEffect;
43 : static IntRect mRect;
44 : };
45 :
46 : } // namespace layers
47 : } // namespace mozilla
48 :
49 : #endif // mozilla_layers_opengl_PaintCounter_h_
|