gfx/layers/client/ClientThebesLayer.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

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: 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 #ifndef GFX_CLIENTTHEBESLAYER_H
michael@0 7 #define GFX_CLIENTTHEBESLAYER_H
michael@0 8
michael@0 9 #include "ClientLayerManager.h" // for ClientLayerManager, etc
michael@0 10 #include "Layers.h" // for ThebesLayer, etc
michael@0 11 #include "RotatedBuffer.h" // for RotatedContentBuffer, etc
michael@0 12 #include "mozilla/Attributes.h" // for MOZ_OVERRIDE
michael@0 13 #include "mozilla/RefPtr.h" // for RefPtr
michael@0 14 #include "mozilla/layers/ContentClient.h" // for ContentClient
michael@0 15 #include "mozilla/mozalloc.h" // for operator delete
michael@0 16 #include "nsDebug.h" // for NS_ASSERTION
michael@0 17 #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
michael@0 18 #include "nsRegion.h" // for nsIntRegion
michael@0 19 #include "mozilla/layers/PLayerTransaction.h" // for ThebesLayerAttributes
michael@0 20
michael@0 21 class gfxContext;
michael@0 22
michael@0 23 namespace mozilla {
michael@0 24 namespace layers {
michael@0 25
michael@0 26 class CompositableClient;
michael@0 27 class ShadowableLayer;
michael@0 28 class SpecificLayerAttributes;
michael@0 29
michael@0 30 class ClientThebesLayer : public ThebesLayer,
michael@0 31 public ClientLayer {
michael@0 32 public:
michael@0 33 typedef RotatedContentBuffer::PaintState PaintState;
michael@0 34 typedef RotatedContentBuffer::ContentType ContentType;
michael@0 35
michael@0 36 ClientThebesLayer(ClientLayerManager* aLayerManager) :
michael@0 37 ThebesLayer(aLayerManager,
michael@0 38 static_cast<ClientLayer*>(MOZ_THIS_IN_INITIALIZER_LIST())),
michael@0 39 mContentClient(nullptr)
michael@0 40 {
michael@0 41 MOZ_COUNT_CTOR(ClientThebesLayer);
michael@0 42 }
michael@0 43 virtual ~ClientThebesLayer()
michael@0 44 {
michael@0 45 if (mContentClient) {
michael@0 46 mContentClient->OnDetach();
michael@0 47 mContentClient = nullptr;
michael@0 48 }
michael@0 49 MOZ_COUNT_DTOR(ClientThebesLayer);
michael@0 50 }
michael@0 51
michael@0 52 virtual void SetVisibleRegion(const nsIntRegion& aRegion)
michael@0 53 {
michael@0 54 NS_ASSERTION(ClientManager()->InConstruction(),
michael@0 55 "Can only set properties in construction phase");
michael@0 56 ThebesLayer::SetVisibleRegion(aRegion);
michael@0 57 }
michael@0 58 virtual void InvalidateRegion(const nsIntRegion& aRegion)
michael@0 59 {
michael@0 60 NS_ASSERTION(ClientManager()->InConstruction(),
michael@0 61 "Can only set properties in construction phase");
michael@0 62 mInvalidRegion.Or(mInvalidRegion, aRegion);
michael@0 63 mInvalidRegion.SimplifyOutward(20);
michael@0 64 mValidRegion.Sub(mValidRegion, mInvalidRegion);
michael@0 65 }
michael@0 66
michael@0 67 virtual void RenderLayer();
michael@0 68
michael@0 69 virtual void ClearCachedResources()
michael@0 70 {
michael@0 71 if (mContentClient) {
michael@0 72 mContentClient->Clear();
michael@0 73 }
michael@0 74 mValidRegion.SetEmpty();
michael@0 75 DestroyBackBuffer();
michael@0 76 }
michael@0 77
michael@0 78 virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
michael@0 79 {
michael@0 80 aAttrs = ThebesLayerAttributes(GetValidRegion());
michael@0 81 }
michael@0 82
michael@0 83 ClientLayerManager* ClientManager()
michael@0 84 {
michael@0 85 return static_cast<ClientLayerManager*>(mManager);
michael@0 86 }
michael@0 87
michael@0 88 virtual Layer* AsLayer() { return this; }
michael@0 89 virtual ShadowableLayer* AsShadowableLayer() { return this; }
michael@0 90
michael@0 91 virtual CompositableClient* GetCompositableClient() MOZ_OVERRIDE
michael@0 92 {
michael@0 93 return mContentClient;
michael@0 94 }
michael@0 95
michael@0 96 virtual void Disconnect()
michael@0 97 {
michael@0 98 mContentClient = nullptr;
michael@0 99 ClientLayer::Disconnect();
michael@0 100 }
michael@0 101
michael@0 102 protected:
michael@0 103 void PaintThebes();
michael@0 104
michael@0 105 void DestroyBackBuffer()
michael@0 106 {
michael@0 107 mContentClient = nullptr;
michael@0 108 }
michael@0 109
michael@0 110 RefPtr<ContentClient> mContentClient;
michael@0 111 };
michael@0 112
michael@0 113 }
michael@0 114 }
michael@0 115
michael@0 116 #endif

mercurial