gfx/layers/client/ClientTiledThebesLayer.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     3  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #ifndef GFX_CLIENTTILEDTHEBESLAYER_H
     6 #define GFX_CLIENTTILEDTHEBESLAYER_H
     8 #include "ClientLayerManager.h"         // for ClientLayer, etc
     9 #include "Layers.h"                     // for ThebesLayer, etc
    10 #include "mozilla/RefPtr.h"             // for RefPtr
    11 #include "mozilla/layers/TiledContentClient.h"
    12 #include "nsDebug.h"                    // for NS_RUNTIMEABORT
    13 #include "nsRegion.h"                   // for nsIntRegion
    15 class gfxContext;
    17 namespace mozilla {
    18 namespace layers {
    20 class ShadowableLayer;
    21 class SpecificLayerAttributes;
    23 /**
    24  * An implementation of ThebesLayer that ONLY supports remote
    25  * composition that is backed by tiles. This thebes layer implementation
    26  * is better suited to mobile hardware to work around slow implementation
    27  * of glTexImage2D (for OGL compositors), and restrait memory bandwidth.
    28  *
    29  * Tiled Thebes layers use a different protocol compared with other
    30  * layers. A copy of the tiled buffer is made and sent to the compositing
    31  * thread via the layers protocol. Tiles are uploaded by the buffers
    32  * asynchonously without using IPC, that means they are not safe for cross-
    33  * process use (bug 747811). Each tile has a TextureHost/Client pair but
    34  * they communicate directly rather than using the Texture protocol.
    35  *
    36  * There is no ContentClient for tiled layers. There is a ContentHost, however.
    37  */
    38 class ClientTiledThebesLayer : public ThebesLayer,
    39                                public ClientLayer
    40 {
    41   typedef ThebesLayer Base;
    43 public:
    44   ClientTiledThebesLayer(ClientLayerManager* const aManager);
    45   ~ClientTiledThebesLayer();
    47   // Override name to distinguish it from ClientThebesLayer in layer dumps
    48   virtual const char* Name() const { return "TiledThebesLayer"; }
    50   // Thebes Layer
    51   virtual Layer* AsLayer() { return this; }
    52   virtual void InvalidateRegion(const nsIntRegion& aRegion) {
    53     mInvalidRegion.Or(mInvalidRegion, aRegion);
    54     mValidRegion.Sub(mValidRegion, aRegion);
    55     mLowPrecisionValidRegion.Sub(mLowPrecisionValidRegion, aRegion);
    56   }
    58   // Shadow methods
    59   virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs);
    60   virtual ShadowableLayer* AsShadowableLayer() { return this; }
    62   virtual void Disconnect()
    63   {
    64     ClientLayer::Disconnect();
    65   }
    67   virtual void RenderLayer();
    69   virtual void ClearCachedResources() MOZ_OVERRIDE;
    71 private:
    72   ClientLayerManager* ClientManager()
    73   {
    74     return static_cast<ClientLayerManager*>(mManager);
    75   }
    77   /**
    78    * For the initial PaintThebes of a transaction, calculates all the data
    79    * needed for that paint and any repeated transactions.
    80    */
    81   void BeginPaint();
    83   /**
    84    * When a paint ends, updates any data necessary to persist until the next
    85    * paint. If aFinish is true, this will cause the paint to be marked as
    86    * finished.
    87    */
    88   void EndPaint(bool aFinish);
    90   RefPtr<TiledContentClient> mContentClient;
    91   nsIntRegion mLowPrecisionValidRegion;
    92   BasicTiledLayerPaintData mPaintData;
    93 };
    95 } // layers
    96 } // mozilla
    98 #endif

mercurial