Backed out 3 changesets (bug 1892041) for causing SM failures in test262. CLOSED...
[gecko.git] / image / WebRenderImageProvider.h
blob84fee8cb47b3ed556f983de1fd82d7733d486ffc
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef MOZILLA_IMAGE_WEBRENDERIMAGEPROVIDER_H_
8 #define MOZILLA_IMAGE_WEBRENDERIMAGEPROVIDER_H_
10 #include "nsISupportsImpl.h"
12 namespace mozilla {
13 namespace layers {
14 class RenderRootStateManager;
17 namespace wr {
18 class IpcResourceUpdateQueue;
19 struct ExternalImageId;
20 struct ImageKey;
21 } // namespace wr
23 namespace image {
25 class ImageResource;
26 using ImageProviderId = uint32_t;
28 class WebRenderImageProvider {
29 public:
30 // Subclasses may or may not be XPCOM classes, so we just require that they
31 // implement AddRef and Release.
32 NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
34 ImageProviderId GetProviderId() const { return mProviderId; }
36 static ImageProviderId AllocateProviderId();
38 /**
39 * Generate an ImageKey for the given frame.
40 * @param aSurface The current frame. This should match what was cached via
41 * SetCurrentFrame, but if it does not, it will need to
42 * regenerate the cached ImageKey.
44 virtual nsresult UpdateKey(layers::RenderRootStateManager* aManager,
45 wr::IpcResourceUpdateQueue& aResources,
46 wr::ImageKey& aKey) {
47 return NS_ERROR_NOT_AVAILABLE;
50 /**
51 * Invalidate if a blob recording, requiring it to be regenerated.
53 virtual void InvalidateRecording() {}
55 protected:
56 WebRenderImageProvider(const ImageResource* aImage);
58 private:
59 ImageProviderId mProviderId;
62 } // namespace image
63 } // namespace mozilla
65 #endif /* MOZILLA_IMAGE_WEBRENDERIMAGEPROVIDER_H_ */