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: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: sw=2 ts=8 et :
3 */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #ifndef mozilla_layers_ShadowLayerUtilsX11_h
9 #define mozilla_layers_ShadowLayerUtilsX11_h
11 #include "ipc/IPCMessageUtils.h"
12 #include "mozilla/GfxMessageUtils.h"
13 #include "nsCOMPtr.h" // for already_AddRefed
15 #define MOZ_HAVE_SURFACEDESCRIPTORX11
16 #define MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS
18 typedef unsigned long XID;
19 typedef XID Drawable;
21 class gfxXlibSurface;
23 namespace IPC {
24 class Message;
25 }
27 namespace mozilla {
28 namespace layers {
30 struct SurfaceDescriptorX11 {
31 SurfaceDescriptorX11()
32 { }
34 SurfaceDescriptorX11(gfxXlibSurface* aSurf);
36 SurfaceDescriptorX11(Drawable aDrawable, XID aFormatID,
37 const gfx::IntSize& aSize);
39 // Default copy ctor and operator= are OK
41 bool operator==(const SurfaceDescriptorX11& aOther) const {
42 // Define == as two descriptors having the same XID for now,
43 // ignoring size and render format. If the two indeed refer to
44 // the same valid XID, then size/format are "actually" the same
45 // anyway, regardless of the values of the fields in
46 // SurfaceDescriptorX11.
47 return mId == aOther.mId;
48 }
50 already_AddRefed<gfxXlibSurface> OpenForeign() const;
52 Drawable mId;
53 XID mFormat; // either a PictFormat or VisualID
54 gfx::IntSize mSize;
55 };
57 } // namespace layers
58 } // namespace mozilla
60 namespace IPC {
62 template <>
63 struct ParamTraits<mozilla::layers::SurfaceDescriptorX11> {
64 typedef mozilla::layers::SurfaceDescriptorX11 paramType;
66 static void Write(Message* aMsg, const paramType& aParam) {
67 WriteParam(aMsg, aParam.mId);
68 WriteParam(aMsg, aParam.mSize);
69 WriteParam(aMsg, aParam.mFormat);
70 }
72 static bool Read(const Message* aMsg, void** aIter, paramType* aResult) {
73 return (ReadParam(aMsg, aIter, &aResult->mId) &&
74 ReadParam(aMsg, aIter, &aResult->mSize) &&
75 ReadParam(aMsg, aIter, &aResult->mFormat));
76 }
77 };
79 } // namespace IPC
81 #endif // mozilla_layers_ShadowLayerUtilsX11_h