2014-07-22 00:59:22 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2015-05-15 03:52:05 +00:00
|
|
|
#ifndef mozilla_image_DynamicImage_h
|
|
|
|
#define mozilla_image_DynamicImage_h
|
2014-07-22 00:59:22 +00:00
|
|
|
|
|
|
|
#include "mozilla/MemoryReporting.h"
|
|
|
|
#include "gfxDrawable.h"
|
|
|
|
#include "Image.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace image {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An Image that is dynamically created. The content of the image is provided by
|
|
|
|
* a gfxDrawable. It's anticipated that most uses of DynamicImage will be
|
|
|
|
* ephemeral.
|
|
|
|
*/
|
|
|
|
class DynamicImage : public Image {
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_IMGICONTAINER
|
|
|
|
|
2014-09-02 16:20:24 +00:00
|
|
|
explicit DynamicImage(gfxDrawable* aDrawable) : mDrawable(aDrawable) {
|
2014-07-22 00:59:22 +00:00
|
|
|
MOZ_ASSERT(aDrawable, "Must have a gfxDrawable to wrap");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Inherited methods from Image.
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual already_AddRefed<ProgressTracker> GetProgressTracker() override;
|
2014-12-06 00:28:00 +00:00
|
|
|
virtual size_t SizeOfSourceWithComputedFallback(
|
2017-07-28 10:10:04 +00:00
|
|
|
SizeOfState& aState) const override;
|
2015-04-28 18:46:17 +00:00
|
|
|
virtual void CollectSizeOfSurfaces(nsTArray<SurfaceMemoryCounter>& aCounters,
|
|
|
|
MallocSizeOf aMallocSizeOf) const override;
|
2014-07-22 00:59:22 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void IncrementAnimationConsumers() override;
|
|
|
|
virtual void DecrementAnimationConsumers() override;
|
2014-07-22 00:59:22 +00:00
|
|
|
#ifdef DEBUG
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual uint32_t GetAnimationConsumers() override;
|
2014-07-22 00:59:22 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
virtual nsresult OnImageDataAvailable(nsIRequest* aRequest,
|
|
|
|
nsIInputStream* aInStr,
|
|
|
|
uint64_t aSourceOffset,
|
2015-03-21 16:28:04 +00:00
|
|
|
uint32_t aCount) override;
|
2021-11-24 11:25:41 +00:00
|
|
|
virtual nsresult OnImageDataComplete(nsIRequest* aRequest, nsresult aStatus,
|
2015-03-21 16:28:04 +00:00
|
|
|
bool aLastPart) override;
|
2014-07-22 00:59:22 +00:00
|
|
|
|
2017-03-16 08:06:06 +00:00
|
|
|
virtual void OnSurfaceDiscarded(const SurfaceKey& aSurfaceKey) override;
|
2014-11-28 03:55:57 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void SetInnerWindowID(uint64_t aInnerWindowId) override;
|
|
|
|
virtual uint64_t InnerWindowID() const override;
|
2014-07-22 00:59:22 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool HasError() override;
|
|
|
|
virtual void SetHasError() override;
|
2014-07-22 00:59:22 +00:00
|
|
|
|
2018-06-06 00:42:56 +00:00
|
|
|
nsIURI* GetURI() const override;
|
2014-07-22 00:59:22 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
virtual ~DynamicImage() {}
|
|
|
|
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<gfxDrawable> mDrawable;
|
2014-07-22 00:59:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace image
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2015-05-15 03:52:05 +00:00
|
|
|
#endif // mozilla_image_DynamicImage_h
|