Bumping manifests a=b2g-bump
[gecko.git] / image / src / ImageWrapper.h
blob16f27850919a770888c05adcf9cd3a8821b3aefa
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 MOZILLA_IMAGELIB_IMAGEWRAPPER_H_
7 #define MOZILLA_IMAGELIB_IMAGEWRAPPER_H_
9 #include "mozilla/MemoryReporting.h"
10 #include "Image.h"
12 namespace mozilla {
13 namespace image {
15 /**
16 * Abstract superclass for Images that wrap other Images.
18 class ImageWrapper : public Image
20 public:
21 NS_DECL_ISUPPORTS
22 NS_DECL_IMGICONTAINER
24 // Inherited methods from Image.
25 virtual nsresult Init(const char* aMimeType, uint32_t aFlags) MOZ_OVERRIDE;
27 virtual already_AddRefed<ProgressTracker> GetProgressTracker() MOZ_OVERRIDE;
29 virtual size_t
30 SizeOfSourceWithComputedFallback( MallocSizeOf aMallocSizeOf) const
31 MOZ_OVERRIDE;
32 virtual size_t
33 SizeOfDecoded(gfxMemoryLocation aLocation,
34 MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
36 virtual void IncrementAnimationConsumers() MOZ_OVERRIDE;
37 virtual void DecrementAnimationConsumers() MOZ_OVERRIDE;
38 #ifdef DEBUG
39 virtual uint32_t GetAnimationConsumers() MOZ_OVERRIDE;
40 #endif
42 virtual nsresult OnImageDataAvailable(nsIRequest* aRequest,
43 nsISupports* aContext,
44 nsIInputStream* aInStr,
45 uint64_t aSourceOffset,
46 uint32_t aCount) MOZ_OVERRIDE;
47 virtual nsresult OnImageDataComplete(nsIRequest* aRequest,
48 nsISupports* aContext,
49 nsresult aStatus,
50 bool aLastPart) MOZ_OVERRIDE;
52 virtual void OnSurfaceDiscarded() MOZ_OVERRIDE;
54 virtual void SetInnerWindowID(uint64_t aInnerWindowId) MOZ_OVERRIDE;
55 virtual uint64_t InnerWindowID() const MOZ_OVERRIDE;
57 virtual bool HasError() MOZ_OVERRIDE;
58 virtual void SetHasError() MOZ_OVERRIDE;
60 virtual ImageURL* GetURI() MOZ_OVERRIDE;
62 protected:
63 explicit ImageWrapper(Image* aInnerImage)
64 : mInnerImage(aInnerImage)
66 MOZ_ASSERT(aInnerImage, "Need an image to wrap");
69 virtual ~ImageWrapper() { }
71 /**
72 * Returns a weak reference to the inner image wrapped by this ImageWrapper.
74 Image* InnerImage() const { return mInnerImage.get(); }
76 void SetInnerImage(Image* aInnerImage)
78 MOZ_ASSERT(aInnerImage, "Need an image to wrap");
79 mInnerImage = aInnerImage;
82 private:
83 nsRefPtr<Image> mInnerImage;
86 } // namespace image
87 } // namespace mozilla
89 #endif // MOZILLA_IMAGELIB_IMAGEWRAPPER_H_