LCOV - code coverage report
Current view: top level - image - MultipartImage.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 7 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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/. */
       5             : 
       6             : #ifndef mozilla_image_MultipartImage_h
       7             : #define mozilla_image_MultipartImage_h
       8             : 
       9             : #include "ImageWrapper.h"
      10             : #include "IProgressObserver.h"
      11             : #include "ProgressTracker.h"
      12             : 
      13             : namespace mozilla {
      14             : namespace image {
      15             : 
      16             : class NextPartObserver;
      17             : 
      18             : /**
      19             :  * An Image wrapper that implements support for multipart/x-mixed-replace
      20             :  * images.
      21             :  */
      22             : class MultipartImage
      23             :   : public ImageWrapper
      24             :   , public IProgressObserver
      25             : {
      26             : public:
      27             :   MOZ_DECLARE_REFCOUNTED_TYPENAME(MultipartImage)
      28             :   NS_DECL_ISUPPORTS_INHERITED
      29             : 
      30             :   void BeginTransitionToPart(Image* aNextPart);
      31             : 
      32             :   // Overridden ImageWrapper methods:
      33             :   virtual already_AddRefed<imgIContainer> Unwrap() override;
      34             :   virtual already_AddRefed<ProgressTracker> GetProgressTracker() override;
      35             :   virtual void SetProgressTracker(ProgressTracker* aTracker) override;
      36             :   virtual nsresult OnImageDataAvailable(nsIRequest* aRequest,
      37             :                                         nsISupports* aContext,
      38             :                                         nsIInputStream* aInStr,
      39             :                                         uint64_t aSourceOffset,
      40             :                                         uint32_t aCount) override;
      41             :   virtual nsresult OnImageDataComplete(nsIRequest* aRequest,
      42             :                                        nsISupports* aContext,
      43             :                                        nsresult aStatus,
      44             :                                        bool aLastPart) override;
      45             : 
      46             :   // We don't support locking or track animation consumers for individual parts,
      47             :   // so we override these methods to do nothing.
      48           0 :   NS_IMETHOD LockImage() override { return NS_OK; }
      49           0 :   NS_IMETHOD UnlockImage() override { return NS_OK; }
      50           0 :   virtual void IncrementAnimationConsumers() override { }
      51           0 :   virtual void DecrementAnimationConsumers() override { }
      52             : #ifdef DEBUG
      53           0 :   virtual uint32_t GetAnimationConsumers() override { return 1; }
      54             : #endif
      55             : 
      56             :   // Overridden IProgressObserver methods:
      57             :   virtual void Notify(int32_t aType,
      58             :                       const nsIntRect* aRect = nullptr) override;
      59             :   virtual void OnLoadComplete(bool aLastPart) override;
      60             :   virtual void SetHasImage() override;
      61             :   virtual bool NotificationsDeferred() const override;
      62             :   virtual void SetNotificationsDeferred(bool aDeferNotifications) override;
      63             : 
      64             :   // We don't allow multipart images to block onload, so we override these
      65             :   // methods to do nothing.
      66           0 :   virtual void BlockOnload() override { }
      67           0 :   virtual void UnblockOnload() override { }
      68             : 
      69             : protected:
      70             :   virtual ~MultipartImage();
      71             : 
      72             : private:
      73             :   friend class ImageFactory;
      74             :   friend class NextPartObserver;
      75             : 
      76             :   explicit MultipartImage(Image* aFirstPart);
      77             :   void Init();
      78             : 
      79             :   void FinishTransition();
      80             : 
      81             :   RefPtr<ProgressTracker> mTracker;
      82             :   RefPtr<NextPartObserver> mNextPartObserver;
      83             :   RefPtr<Image> mNextPart;
      84             :   bool mDeferNotifications : 1;
      85             : };
      86             : 
      87             : } // namespace image
      88             : } // namespace mozilla
      89             : 
      90             : #endif // mozilla_image_MultipartImage_h

Generated by: LCOV version 1.13