Skip to content

Commit

Permalink
Bug 1379920 - Introduce WebRenderCanvasData. r=kats
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: 4aBfWib1bQq
  • Loading branch information
mephisto41 committed Aug 3, 2017
1 parent f3d4ff4 commit 23c9ce9
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
20 changes: 20 additions & 0 deletions gfx/layers/wr/WebRenderUserData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "mozilla/layers/WebRenderLayerManager.h"
#include "mozilla/layers/WebRenderMessages.h"
#include "nsDisplayListInvalidation.h"
#include "WebRenderCanvasRenderer.h"

namespace mozilla {
namespace layers {
Expand Down Expand Up @@ -190,5 +191,24 @@ WebRenderAnimationData::WebRenderAnimationData(WebRenderLayerManager* aWRManager
{
}

WebRenderCanvasData::WebRenderCanvasData(WebRenderLayerManager* aWRManager)
: WebRenderUserData(aWRManager)
{
}

WebRenderCanvasData::~WebRenderCanvasData()
{
}

WebRenderCanvasRendererAsync*
WebRenderCanvasData::GetCanvasRenderer()
{
if (!mCanvasRenderer) {
mCanvasRenderer = MakeUnique<WebRenderCanvasRendererAsync>(mWRManager);
}

return mCanvasRenderer.get();
}

} // namespace layers
} // namespace mozilla
21 changes: 21 additions & 0 deletions gfx/layers/wr/WebRenderUserData.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ class nsDisplayItemGeometry;

namespace mozilla {
namespace layers {
class CanvasLayer;
class ImageClient;
class ImageContainer;
class WebRenderBridgeChild;
class WebRenderCanvasData;
class WebRenderCanvasRendererAsync;
class WebRenderImageData;
class WebRenderFallbackData;
class WebRenderLayerManager;
Expand All @@ -30,11 +33,13 @@ class WebRenderUserData

virtual WebRenderImageData* AsImageData() { return nullptr; }
virtual WebRenderFallbackData* AsFallbackData() { return nullptr; }
virtual WebRenderCanvasData* AsCanvasData() { return nullptr; }

enum class UserDataType {
eImage,
eFallback,
eAnimation,
eCanvas,
};

virtual UserDataType GetType() = 0;
Expand Down Expand Up @@ -120,6 +125,22 @@ class WebRenderAnimationData : public WebRenderUserData
AnimationInfo mAnimationInfo;
};

class WebRenderCanvasData : public WebRenderUserData
{
public:
explicit WebRenderCanvasData(WebRenderLayerManager* aWRManager);
virtual ~WebRenderCanvasData();

virtual WebRenderCanvasData* AsCanvasData() override { return this; }
virtual UserDataType GetType() override { return UserDataType::eCanvas; }
static UserDataType Type() { return UserDataType::eCanvas; }

WebRenderCanvasRendererAsync* GetCanvasRenderer();

protected:
UniquePtr<WebRenderCanvasRendererAsync> mCanvasRenderer;
};

} // namespace layers
} // namespace mozilla

Expand Down

0 comments on commit 23c9ce9

Please sign in to comment.