Bumping manifests a=b2g-bump
[gecko.git] / image / src / DynamicImage.h
blob207f126e683a2f242b470920469a04311bf4b68a
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_DYNAMICIMAGE_H_
7 #define MOZILLA_IMAGELIB_DYNAMICIMAGE_H_
9 #include "mozilla/MemoryReporting.h"
10 #include "gfxDrawable.h"
11 #include "Image.h"
13 namespace mozilla {
14 namespace image {
16 /**
18 * An Image that is dynamically created. The content of the image is provided by
19 * a gfxDrawable. It's anticipated that most uses of DynamicImage will be
20 * ephemeral.
22 class DynamicImage : public Image
24 public:
25 NS_DECL_ISUPPORTS
26 NS_DECL_IMGICONTAINER
28 DynamicImage(gfxDrawable* aDrawable)
29 : mDrawable(aDrawable)
31 MOZ_ASSERT(aDrawable, "Must have a gfxDrawable to wrap");
34 // Inherited methods from Image.
35 virtual nsresult Init(const char* aMimeType, uint32_t aFlags) MOZ_OVERRIDE;
37 virtual already_AddRefed<imgStatusTracker> GetStatusTracker() MOZ_OVERRIDE;
38 virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE;
40 virtual uint32_t SizeOfData() MOZ_OVERRIDE;
41 virtual size_t HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
42 virtual size_t HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
43 virtual size_t NonHeapSizeOfDecoded() const MOZ_OVERRIDE;
44 virtual size_t OutOfProcessSizeOfDecoded() const MOZ_OVERRIDE;
45 virtual size_t HeapSizeOfVectorImageDocument(nsACString* aDocURL = nullptr) const MOZ_OVERRIDE;
47 virtual void IncrementAnimationConsumers() MOZ_OVERRIDE;
48 virtual void DecrementAnimationConsumers() MOZ_OVERRIDE;
49 #ifdef DEBUG
50 virtual uint32_t GetAnimationConsumers() MOZ_OVERRIDE;
51 #endif
53 virtual nsresult OnImageDataAvailable(nsIRequest* aRequest,
54 nsISupports* aContext,
55 nsIInputStream* aInStr,
56 uint64_t aSourceOffset,
57 uint32_t aCount) MOZ_OVERRIDE;
58 virtual nsresult OnImageDataComplete(nsIRequest* aRequest,
59 nsISupports* aContext,
60 nsresult aStatus,
61 bool aLastPart) MOZ_OVERRIDE;
62 virtual nsresult OnNewSourceData() MOZ_OVERRIDE;
64 virtual void SetInnerWindowID(uint64_t aInnerWindowId) MOZ_OVERRIDE;
65 virtual uint64_t InnerWindowID() const MOZ_OVERRIDE;
67 virtual bool HasError() MOZ_OVERRIDE;
68 virtual void SetHasError() MOZ_OVERRIDE;
70 virtual ImageURL* GetURI() MOZ_OVERRIDE;
72 private:
73 virtual ~DynamicImage() { }
75 nsRefPtr<gfxDrawable> mDrawable;
78 } // namespace image
79 } // namespace mozilla
81 #endif // MOZILLA_IMAGELIB_DYNAMICIMAGE_H_