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"
14 class RenderRootStateManager
;
18 class IpcResourceUpdateQueue
;
19 struct ExternalImageId
;
26 using ImageProviderId
= uint32_t;
28 class WebRenderImageProvider
{
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();
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
,
47 return NS_ERROR_NOT_AVAILABLE
;
51 * Invalidate if a blob recording, requiring it to be regenerated.
53 virtual void InvalidateRecording() {}
56 WebRenderImageProvider(const ImageResource
* aImage
);
59 ImageProviderId mProviderId
;
63 } // namespace mozilla
65 #endif /* MOZILLA_IMAGE_WEBRENDERIMAGEPROVIDER_H_ */