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.

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

mercurial