Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 20; 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 | #ifndef MOZILLA_GFX_IMAGECLIENT_H |
michael@0 | 7 | #define MOZILLA_GFX_IMAGECLIENT_H |
michael@0 | 8 | |
michael@0 | 9 | #include <stdint.h> // for uint32_t, uint64_t |
michael@0 | 10 | #include <sys/types.h> // for int32_t |
michael@0 | 11 | #include "mozilla/Attributes.h" // for MOZ_OVERRIDE |
michael@0 | 12 | #include "mozilla/RefPtr.h" // for RefPtr, TemporaryRef |
michael@0 | 13 | #include "mozilla/gfx/Types.h" // for SurfaceFormat |
michael@0 | 14 | #include "mozilla/layers/CompositableClient.h" // for CompositableClient |
michael@0 | 15 | #include "mozilla/layers/CompositorTypes.h" // for CompositableType, etc |
michael@0 | 16 | #include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor |
michael@0 | 17 | #include "mozilla/layers/TextureClient.h" // for TextureClient, etc |
michael@0 | 18 | #include "mozilla/mozalloc.h" // for operator delete |
michael@0 | 19 | #include "nsCOMPtr.h" // for already_AddRefed |
michael@0 | 20 | #include "nsRect.h" // for nsIntRect |
michael@0 | 21 | |
michael@0 | 22 | namespace mozilla { |
michael@0 | 23 | namespace layers { |
michael@0 | 24 | |
michael@0 | 25 | class CompositableForwarder; |
michael@0 | 26 | class Image; |
michael@0 | 27 | class ImageContainer; |
michael@0 | 28 | class ShadowableLayer; |
michael@0 | 29 | |
michael@0 | 30 | /** |
michael@0 | 31 | * Image clients are used by basic image layers on the content thread, they |
michael@0 | 32 | * always match with an ImageHost on the compositor thread. See |
michael@0 | 33 | * CompositableClient.h for information on connecting clients to hosts. |
michael@0 | 34 | */ |
michael@0 | 35 | class ImageClient : public CompositableClient |
michael@0 | 36 | { |
michael@0 | 37 | public: |
michael@0 | 38 | /** |
michael@0 | 39 | * Creates, configures, and returns a new image client. If necessary, a |
michael@0 | 40 | * message will be sent to the compositor to create a corresponding image |
michael@0 | 41 | * host. |
michael@0 | 42 | */ |
michael@0 | 43 | static TemporaryRef<ImageClient> CreateImageClient(CompositableType aImageHostType, |
michael@0 | 44 | CompositableForwarder* aFwd, |
michael@0 | 45 | TextureFlags aFlags); |
michael@0 | 46 | |
michael@0 | 47 | virtual ~ImageClient() {} |
michael@0 | 48 | |
michael@0 | 49 | /** |
michael@0 | 50 | * Update this ImageClient from aContainer in aLayer |
michael@0 | 51 | * returns false if this is the wrong kind of ImageClient for aContainer. |
michael@0 | 52 | * Note that returning true does not necessarily imply success |
michael@0 | 53 | */ |
michael@0 | 54 | virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags) = 0; |
michael@0 | 55 | |
michael@0 | 56 | /** |
michael@0 | 57 | * The picture rect is the area of the texture which makes up the image. That |
michael@0 | 58 | * is, the area that should be composited. In texture space. |
michael@0 | 59 | */ |
michael@0 | 60 | virtual void UpdatePictureRect(nsIntRect aPictureRect); |
michael@0 | 61 | |
michael@0 | 62 | virtual already_AddRefed<Image> CreateImage(ImageFormat aFormat) = 0; |
michael@0 | 63 | |
michael@0 | 64 | /** |
michael@0 | 65 | * Synchronously remove all the textures used by the image client. |
michael@0 | 66 | */ |
michael@0 | 67 | virtual void FlushAllImages(bool aExceptFront) {} |
michael@0 | 68 | |
michael@0 | 69 | protected: |
michael@0 | 70 | ImageClient(CompositableForwarder* aFwd, TextureFlags aFlags, |
michael@0 | 71 | CompositableType aType); |
michael@0 | 72 | |
michael@0 | 73 | CompositableType mType; |
michael@0 | 74 | int32_t mLastPaintedImageSerial; |
michael@0 | 75 | nsIntRect mPictureRect; |
michael@0 | 76 | }; |
michael@0 | 77 | |
michael@0 | 78 | /** |
michael@0 | 79 | * An image client which uses a single texture client. |
michael@0 | 80 | */ |
michael@0 | 81 | class ImageClientSingle : public ImageClient |
michael@0 | 82 | { |
michael@0 | 83 | public: |
michael@0 | 84 | ImageClientSingle(CompositableForwarder* aFwd, |
michael@0 | 85 | TextureFlags aFlags, |
michael@0 | 86 | CompositableType aType); |
michael@0 | 87 | |
michael@0 | 88 | virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags); |
michael@0 | 89 | |
michael@0 | 90 | virtual void OnDetach() MOZ_OVERRIDE; |
michael@0 | 91 | |
michael@0 | 92 | virtual bool AddTextureClient(TextureClient* aTexture) MOZ_OVERRIDE; |
michael@0 | 93 | |
michael@0 | 94 | virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE; |
michael@0 | 95 | |
michael@0 | 96 | virtual already_AddRefed<Image> CreateImage(ImageFormat aFormat) MOZ_OVERRIDE; |
michael@0 | 97 | |
michael@0 | 98 | virtual void FlushAllImages(bool aExceptFront) MOZ_OVERRIDE; |
michael@0 | 99 | |
michael@0 | 100 | protected: |
michael@0 | 101 | virtual bool UpdateImageInternal(ImageContainer* aContainer, uint32_t aContentFlags, bool* aIsSwapped); |
michael@0 | 102 | |
michael@0 | 103 | protected: |
michael@0 | 104 | RefPtr<TextureClient> mFrontBuffer; |
michael@0 | 105 | }; |
michael@0 | 106 | |
michael@0 | 107 | /** |
michael@0 | 108 | * An image client which uses two texture clients. |
michael@0 | 109 | */ |
michael@0 | 110 | class ImageClientBuffered : public ImageClientSingle |
michael@0 | 111 | { |
michael@0 | 112 | public: |
michael@0 | 113 | ImageClientBuffered(CompositableForwarder* aFwd, |
michael@0 | 114 | TextureFlags aFlags, |
michael@0 | 115 | CompositableType aType); |
michael@0 | 116 | |
michael@0 | 117 | virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags); |
michael@0 | 118 | |
michael@0 | 119 | virtual void OnDetach() MOZ_OVERRIDE; |
michael@0 | 120 | |
michael@0 | 121 | virtual void FlushAllImages(bool aExceptFront) MOZ_OVERRIDE; |
michael@0 | 122 | |
michael@0 | 123 | protected: |
michael@0 | 124 | RefPtr<TextureClient> mBackBuffer; |
michael@0 | 125 | }; |
michael@0 | 126 | |
michael@0 | 127 | /** |
michael@0 | 128 | * Image class to be used for async image uploads using the image bridge |
michael@0 | 129 | * protocol. |
michael@0 | 130 | * We store the ImageBridge id in the TextureClientIdentifier. |
michael@0 | 131 | */ |
michael@0 | 132 | class ImageClientBridge : public ImageClient |
michael@0 | 133 | { |
michael@0 | 134 | public: |
michael@0 | 135 | ImageClientBridge(CompositableForwarder* aFwd, |
michael@0 | 136 | TextureFlags aFlags); |
michael@0 | 137 | |
michael@0 | 138 | virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags); |
michael@0 | 139 | virtual bool Connect() { return false; } |
michael@0 | 140 | virtual void Updated() {} |
michael@0 | 141 | void SetLayer(ShadowableLayer* aLayer) |
michael@0 | 142 | { |
michael@0 | 143 | mLayer = aLayer; |
michael@0 | 144 | } |
michael@0 | 145 | |
michael@0 | 146 | virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE |
michael@0 | 147 | { |
michael@0 | 148 | return TextureInfo(mType); |
michael@0 | 149 | } |
michael@0 | 150 | |
michael@0 | 151 | virtual void SetIPDLActor(CompositableChild* aChild) MOZ_OVERRIDE |
michael@0 | 152 | { |
michael@0 | 153 | MOZ_ASSERT(!aChild, "ImageClientBridge should not have IPDL actor"); |
michael@0 | 154 | } |
michael@0 | 155 | |
michael@0 | 156 | virtual already_AddRefed<Image> CreateImage(ImageFormat aFormat) MOZ_OVERRIDE |
michael@0 | 157 | { |
michael@0 | 158 | NS_WARNING("Should not create an image through an ImageClientBridge"); |
michael@0 | 159 | return nullptr; |
michael@0 | 160 | } |
michael@0 | 161 | |
michael@0 | 162 | protected: |
michael@0 | 163 | uint64_t mAsyncContainerID; |
michael@0 | 164 | ShadowableLayer* mLayer; |
michael@0 | 165 | }; |
michael@0 | 166 | |
michael@0 | 167 | } |
michael@0 | 168 | } |
michael@0 | 169 | |
michael@0 | 170 | #endif |