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_SIMPLETILEDCONTENTCLIENT_H |
michael@0 | 7 | #define MOZILLA_GFX_SIMPLETILEDCONTENTCLIENT_H |
michael@0 | 8 | |
michael@0 | 9 | // We include this header here so that we don't need to |
michael@0 | 10 | // duplicate BasicTiledLayerPaintData |
michael@0 | 11 | #include "TiledContentClient.h" |
michael@0 | 12 | |
michael@0 | 13 | #include "SharedBuffer.h" |
michael@0 | 14 | |
michael@0 | 15 | namespace mozilla { |
michael@0 | 16 | namespace layers { |
michael@0 | 17 | |
michael@0 | 18 | class ClientTiledThebesLayer; |
michael@0 | 19 | |
michael@0 | 20 | class SimpleTiledLayerTile; |
michael@0 | 21 | class SimpleTiledLayerBuffer; |
michael@0 | 22 | class SimpleClientTiledThebesLayer; |
michael@0 | 23 | class SimpleTiledLayerBuffer; |
michael@0 | 24 | |
michael@0 | 25 | #define GFX_SIMP_TILEDLAYER_DEBUG_OVERLAY |
michael@0 | 26 | |
michael@0 | 27 | struct SimpleTiledLayerTile |
michael@0 | 28 | { |
michael@0 | 29 | RefPtr<TextureClient> mTileBuffer; |
michael@0 | 30 | RefPtr<ClientLayerManager> mManager; |
michael@0 | 31 | nsRefPtr<SharedBuffer> mCachedBuffer; |
michael@0 | 32 | TimeStamp mLastUpdate; |
michael@0 | 33 | |
michael@0 | 34 | SimpleTiledLayerTile() { } |
michael@0 | 35 | |
michael@0 | 36 | SimpleTiledLayerTile(ClientLayerManager *aManager, TextureClient *aBuffer) |
michael@0 | 37 | : mTileBuffer(aBuffer) |
michael@0 | 38 | , mManager(aManager) |
michael@0 | 39 | { } |
michael@0 | 40 | |
michael@0 | 41 | bool operator== (const SimpleTiledLayerTile& o) const |
michael@0 | 42 | { |
michael@0 | 43 | return mTileBuffer == o.mTileBuffer; |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | bool operator!= (const SimpleTiledLayerTile& o) const |
michael@0 | 47 | { |
michael@0 | 48 | return mTileBuffer != o.mTileBuffer; |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | void SetLayerManager(ClientLayerManager *aManager) |
michael@0 | 52 | { |
michael@0 | 53 | mManager = aManager; |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | bool IsPlaceholderTile() |
michael@0 | 57 | { |
michael@0 | 58 | return mTileBuffer == nullptr; |
michael@0 | 59 | } |
michael@0 | 60 | |
michael@0 | 61 | TileDescriptor GetTileDescriptor() |
michael@0 | 62 | { |
michael@0 | 63 | if (mTileBuffer) |
michael@0 | 64 | return TexturedTileDescriptor(nullptr, mTileBuffer->GetIPDLActor(), 0); |
michael@0 | 65 | |
michael@0 | 66 | NS_NOTREACHED("Unhandled SimpleTiledLayerTile type"); |
michael@0 | 67 | return PlaceholderTileDescriptor(); |
michael@0 | 68 | } |
michael@0 | 69 | |
michael@0 | 70 | void Release() |
michael@0 | 71 | { |
michael@0 | 72 | mTileBuffer = nullptr; |
michael@0 | 73 | mCachedBuffer = nullptr; |
michael@0 | 74 | } |
michael@0 | 75 | }; |
michael@0 | 76 | |
michael@0 | 77 | class SimpleTiledLayerBuffer |
michael@0 | 78 | : public TiledLayerBuffer<SimpleTiledLayerBuffer, SimpleTiledLayerTile> |
michael@0 | 79 | { |
michael@0 | 80 | friend class TiledLayerBuffer<SimpleTiledLayerBuffer, SimpleTiledLayerTile>; |
michael@0 | 81 | |
michael@0 | 82 | public: |
michael@0 | 83 | SimpleTiledLayerBuffer(SimpleClientTiledThebesLayer* aThebesLayer, |
michael@0 | 84 | CompositableClient* aCompositableClient, |
michael@0 | 85 | ClientLayerManager* aManager) |
michael@0 | 86 | : mThebesLayer(aThebesLayer) |
michael@0 | 87 | , mCompositableClient(aCompositableClient) |
michael@0 | 88 | , mManager(aManager) |
michael@0 | 89 | , mLastPaintOpaque(false) |
michael@0 | 90 | {} |
michael@0 | 91 | |
michael@0 | 92 | SimpleTiledLayerBuffer() |
michael@0 | 93 | : mLastPaintOpaque(false) |
michael@0 | 94 | {} |
michael@0 | 95 | |
michael@0 | 96 | void PaintThebes(const nsIntRegion& aNewValidRegion, |
michael@0 | 97 | const nsIntRegion& aPaintRegion, |
michael@0 | 98 | LayerManager::DrawThebesLayerCallback aCallback, |
michael@0 | 99 | void* aCallbackData); |
michael@0 | 100 | |
michael@0 | 101 | SurfaceDescriptorTiles GetSurfaceDescriptorTiles(); |
michael@0 | 102 | |
michael@0 | 103 | void Release() { |
michael@0 | 104 | for (size_t i = 0; i < mRetainedTiles.Length(); i++) { |
michael@0 | 105 | mRetainedTiles[i].Release(); |
michael@0 | 106 | } |
michael@0 | 107 | } |
michael@0 | 108 | |
michael@0 | 109 | const CSSToParentLayerScale& GetFrameResolution() const { return mFrameResolution; } |
michael@0 | 110 | void SetFrameResolution(const CSSToParentLayerScale& aResolution) { mFrameResolution = aResolution; } |
michael@0 | 111 | |
michael@0 | 112 | bool HasFormatChanged() const; |
michael@0 | 113 | private: |
michael@0 | 114 | SimpleClientTiledThebesLayer* mThebesLayer; |
michael@0 | 115 | CompositableClient* mCompositableClient; |
michael@0 | 116 | ClientLayerManager* mManager; |
michael@0 | 117 | LayerManager::DrawThebesLayerCallback mCallback; |
michael@0 | 118 | void* mCallbackData; |
michael@0 | 119 | CSSToParentLayerScale mFrameResolution; |
michael@0 | 120 | bool mLastPaintOpaque; |
michael@0 | 121 | |
michael@0 | 122 | gfxContentType GetContentType() const; |
michael@0 | 123 | |
michael@0 | 124 | SimpleTiledLayerTile ValidateTile(SimpleTiledLayerTile aTile, |
michael@0 | 125 | const nsIntPoint& aTileOrigin, |
michael@0 | 126 | const nsIntRegion& aDirtyRect); |
michael@0 | 127 | |
michael@0 | 128 | SimpleTiledLayerTile GetPlaceholderTile() const { return SimpleTiledLayerTile(); } |
michael@0 | 129 | |
michael@0 | 130 | void ReleaseTile(SimpleTiledLayerTile aTile) { aTile.Release(); } |
michael@0 | 131 | |
michael@0 | 132 | void SwapTiles(SimpleTiledLayerTile& aTileA, SimpleTiledLayerTile& aTileB) { std::swap(aTileA, aTileB); } |
michael@0 | 133 | }; |
michael@0 | 134 | |
michael@0 | 135 | class SimpleTiledContentClient : public CompositableClient |
michael@0 | 136 | { |
michael@0 | 137 | friend class SimpleClientTiledThebesLayer; |
michael@0 | 138 | |
michael@0 | 139 | public: |
michael@0 | 140 | SimpleTiledContentClient(SimpleClientTiledThebesLayer* aThebesLayer, |
michael@0 | 141 | ClientLayerManager* aManager); |
michael@0 | 142 | |
michael@0 | 143 | ~SimpleTiledContentClient(); |
michael@0 | 144 | |
michael@0 | 145 | virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE |
michael@0 | 146 | { |
michael@0 | 147 | return TextureInfo(BUFFER_SIMPLE_TILED); |
michael@0 | 148 | } |
michael@0 | 149 | |
michael@0 | 150 | void UseTiledLayerBuffer(); |
michael@0 | 151 | |
michael@0 | 152 | private: |
michael@0 | 153 | SimpleTiledLayerBuffer mTiledBuffer; |
michael@0 | 154 | }; |
michael@0 | 155 | |
michael@0 | 156 | class SimpleClientTiledThebesLayer : public ThebesLayer, |
michael@0 | 157 | public ClientLayer |
michael@0 | 158 | { |
michael@0 | 159 | typedef ThebesLayer Base; |
michael@0 | 160 | |
michael@0 | 161 | public: |
michael@0 | 162 | SimpleClientTiledThebesLayer(ClientLayerManager* const aManager); |
michael@0 | 163 | ~SimpleClientTiledThebesLayer(); |
michael@0 | 164 | |
michael@0 | 165 | // Thebes Layer |
michael@0 | 166 | virtual Layer* AsLayer() { return this; } |
michael@0 | 167 | virtual void InvalidateRegion(const nsIntRegion& aRegion) { |
michael@0 | 168 | mInvalidRegion.Or(mInvalidRegion, aRegion); |
michael@0 | 169 | mValidRegion.Sub(mValidRegion, aRegion); |
michael@0 | 170 | } |
michael@0 | 171 | |
michael@0 | 172 | // Shadow methods |
michael@0 | 173 | virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs); |
michael@0 | 174 | virtual ShadowableLayer* AsShadowableLayer() { return this; } |
michael@0 | 175 | |
michael@0 | 176 | virtual void Disconnect() { ClientLayer::Disconnect(); } |
michael@0 | 177 | |
michael@0 | 178 | virtual void RenderLayer(); |
michael@0 | 179 | |
michael@0 | 180 | protected: |
michael@0 | 181 | ClientLayerManager* ClientManager() { return static_cast<ClientLayerManager*>(mManager); } |
michael@0 | 182 | |
michael@0 | 183 | RefPtr<SimpleTiledContentClient> mContentClient; |
michael@0 | 184 | }; |
michael@0 | 185 | |
michael@0 | 186 | } // mozilla |
michael@0 | 187 | } // layers |
michael@0 | 188 | |
michael@0 | 189 | #endif |