Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | // This is a general tool that will let you visualize platform operation. |
michael@0 | 7 | // Currently used for the layer system, the general syntax allows this |
michael@0 | 8 | // tools to be adapted to trace other operations. |
michael@0 | 9 | // |
michael@0 | 10 | // For the front end see: https://github.com/staktrace/rendertrace |
michael@0 | 11 | |
michael@0 | 12 | // Uncomment this line to enable RENDERTRACE |
michael@0 | 13 | //#define MOZ_RENDERTRACE |
michael@0 | 14 | |
michael@0 | 15 | #ifndef GFX_RENDERTRACE_H |
michael@0 | 16 | #define GFX_RENDERTRACE_H |
michael@0 | 17 | |
michael@0 | 18 | #include "gfx3DMatrix.h" |
michael@0 | 19 | #include "nsRect.h" |
michael@0 | 20 | |
michael@0 | 21 | namespace mozilla { |
michael@0 | 22 | namespace layers { |
michael@0 | 23 | |
michael@0 | 24 | class Layer; |
michael@0 | 25 | |
michael@0 | 26 | void RenderTraceLayers(Layer *aLayer, const char *aColor, const gfx3DMatrix aRootTransform = gfx3DMatrix(), bool aReset = true); |
michael@0 | 27 | |
michael@0 | 28 | void RenderTraceInvalidateStart(Layer *aLayer, const char *aColor, const nsIntRect aRect); |
michael@0 | 29 | void RenderTraceInvalidateEnd(Layer *aLayer, const char *aColor); |
michael@0 | 30 | |
michael@0 | 31 | void renderTraceEventStart(const char *aComment, const char *aColor); |
michael@0 | 32 | void renderTraceEventEnd(const char *aComment, const char *aColor); |
michael@0 | 33 | void renderTraceEventEnd(const char *aColor); |
michael@0 | 34 | |
michael@0 | 35 | struct RenderTraceScope { |
michael@0 | 36 | public: |
michael@0 | 37 | RenderTraceScope(const char *aComment, const char *aColor) |
michael@0 | 38 | : mComment(aComment) |
michael@0 | 39 | , mColor(aColor) |
michael@0 | 40 | { |
michael@0 | 41 | renderTraceEventStart(mComment, mColor); |
michael@0 | 42 | } |
michael@0 | 43 | ~RenderTraceScope() { |
michael@0 | 44 | renderTraceEventEnd(mComment, mColor); |
michael@0 | 45 | } |
michael@0 | 46 | private: |
michael@0 | 47 | const char *mComment; |
michael@0 | 48 | const char *mColor; |
michael@0 | 49 | }; |
michael@0 | 50 | |
michael@0 | 51 | #ifndef MOZ_RENDERTRACE |
michael@0 | 52 | inline void RenderTraceLayers(Layer *aLayer, const char *aColor, const gfx3DMatrix aRootTransform, bool aReset) |
michael@0 | 53 | {} |
michael@0 | 54 | |
michael@0 | 55 | inline void RenderTraceInvalidateStart(Layer *aLayer, const char *aColor, const nsIntRect aRect) |
michael@0 | 56 | {} |
michael@0 | 57 | |
michael@0 | 58 | inline void RenderTraceInvalidateEnd(Layer *aLayer, const char *aColor) |
michael@0 | 59 | {} |
michael@0 | 60 | |
michael@0 | 61 | inline void renderTraceEventStart(const char *aComment, const char *aColor) |
michael@0 | 62 | {} |
michael@0 | 63 | |
michael@0 | 64 | inline void renderTraceEventEnd(const char *aComment, const char *aColor) |
michael@0 | 65 | {} |
michael@0 | 66 | |
michael@0 | 67 | inline void renderTraceEventEnd(const char *aColor) |
michael@0 | 68 | {} |
michael@0 | 69 | |
michael@0 | 70 | #endif // MOZ_RENDERTRACE |
michael@0 | 71 | |
michael@0 | 72 | } |
michael@0 | 73 | } |
michael@0 | 74 | |
michael@0 | 75 | #endif //GFX_RENDERTRACE_H |