Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
1 /* -*- Mode: C++; tab-width: 2; 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/. */
6 // This is a general tool that will let you visualize platform operation.
7 // Currently used for the layer system, the general syntax allows this
8 // tools to be adapted to trace other operations.
9 //
10 // For the front end see: https://github.com/staktrace/rendertrace
12 // Uncomment this line to enable RENDERTRACE
13 //#define MOZ_RENDERTRACE
15 #ifndef GFX_RENDERTRACE_H
16 #define GFX_RENDERTRACE_H
18 #include "gfx3DMatrix.h"
19 #include "nsRect.h"
21 namespace mozilla {
22 namespace layers {
24 class Layer;
26 void RenderTraceLayers(Layer *aLayer, const char *aColor, const gfx3DMatrix aRootTransform = gfx3DMatrix(), bool aReset = true);
28 void RenderTraceInvalidateStart(Layer *aLayer, const char *aColor, const nsIntRect aRect);
29 void RenderTraceInvalidateEnd(Layer *aLayer, const char *aColor);
31 void renderTraceEventStart(const char *aComment, const char *aColor);
32 void renderTraceEventEnd(const char *aComment, const char *aColor);
33 void renderTraceEventEnd(const char *aColor);
35 struct RenderTraceScope {
36 public:
37 RenderTraceScope(const char *aComment, const char *aColor)
38 : mComment(aComment)
39 , mColor(aColor)
40 {
41 renderTraceEventStart(mComment, mColor);
42 }
43 ~RenderTraceScope() {
44 renderTraceEventEnd(mComment, mColor);
45 }
46 private:
47 const char *mComment;
48 const char *mColor;
49 };
51 #ifndef MOZ_RENDERTRACE
52 inline void RenderTraceLayers(Layer *aLayer, const char *aColor, const gfx3DMatrix aRootTransform, bool aReset)
53 {}
55 inline void RenderTraceInvalidateStart(Layer *aLayer, const char *aColor, const nsIntRect aRect)
56 {}
58 inline void RenderTraceInvalidateEnd(Layer *aLayer, const char *aColor)
59 {}
61 inline void renderTraceEventStart(const char *aComment, const char *aColor)
62 {}
64 inline void renderTraceEventEnd(const char *aComment, const char *aColor)
65 {}
67 inline void renderTraceEventEnd(const char *aColor)
68 {}
70 #endif // MOZ_RENDERTRACE
72 }
73 }
75 #endif //GFX_RENDERTRACE_H