Commit f92c2854 authored by xidachen's avatar xidachen Committed by Commit bot

Minor clean up in transferToImageBitmap API

The transferToImageBitmap is an API in OffscreenCanvas. This API could
throw exception in certain cases, which means that the
OffscreenCanvas::transferToImageBitmap() method has a ExceptionState&
parameter.

In our current implementation, we do all the exception check in the above
method. However, we still pass the ExceptionState& parameter to the
CanvasRenderingContext::transferToImageBitmap() method, and this method
is overriden by OffscreenCanvasRenderingContext2D, WebGLRenderingContext,
and WebGL2RenderingContext. So this method in all these sub-classes also
take a ExceptionState& parameter but do nothing with it. We should not
need to pass this parameter to CanvasRenderingContext::transferToImageBitmap.

TBR=kbr@chromium.org, zmo@chromium.org
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.win:win_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2440213003
Cr-Commit-Position: refs/heads/master@{#427188}
parent ba99bac8
...@@ -165,9 +165,7 @@ class CORE_EXPORT CanvasRenderingContext ...@@ -165,9 +165,7 @@ class CORE_EXPORT CanvasRenderingContext
// OffscreenCanvas-specific methods // OffscreenCanvas-specific methods
OffscreenCanvas* getOffscreenCanvas() const { return m_offscreenCanvas; } OffscreenCanvas* getOffscreenCanvas() const { return m_offscreenCanvas; }
virtual ImageBitmap* transferToImageBitmap(ExceptionState&) { virtual ImageBitmap* transferToImageBitmap() { return nullptr; }
return nullptr;
}
bool wouldTaintOrigin(CanvasImageSource*, SecurityOrigin* = nullptr); bool wouldTaintOrigin(CanvasImageSource*, SecurityOrigin* = nullptr);
void didMoveToNewDocument(Document*); void didMoveToNewDocument(Document*);
......
...@@ -76,7 +76,7 @@ ImageBitmap* OffscreenCanvas::transferToImageBitmap( ...@@ -76,7 +76,7 @@ ImageBitmap* OffscreenCanvas::transferToImageBitmap(
"OffscreenCanvas with no context"); "OffscreenCanvas with no context");
return nullptr; return nullptr;
} }
ImageBitmap* image = m_context->transferToImageBitmap(exceptionState); ImageBitmap* image = m_context->transferToImageBitmap();
if (!image) { if (!image) {
// Undocumented exception (not in spec) // Undocumented exception (not in spec)
exceptionState.throwDOMException(V8Error, "Out of memory"); exceptionState.throwDOMException(V8Error, "Out of memory");
......
...@@ -137,8 +137,7 @@ OffscreenCanvasRenderingContext2D::transferToStaticBitmapImage() { ...@@ -137,8 +137,7 @@ OffscreenCanvasRenderingContext2D::transferToStaticBitmapImage() {
return image; return image;
} }
ImageBitmap* OffscreenCanvasRenderingContext2D::transferToImageBitmap( ImageBitmap* OffscreenCanvasRenderingContext2D::transferToImageBitmap() {
ExceptionState& exceptionState) {
RefPtr<StaticBitmapImage> image = transferToStaticBitmapImage(); RefPtr<StaticBitmapImage> image = transferToStaticBitmapImage();
if (!image) if (!image)
return nullptr; return nullptr;
......
...@@ -82,7 +82,7 @@ class MODULES_EXPORT OffscreenCanvasRenderingContext2D final ...@@ -82,7 +82,7 @@ class MODULES_EXPORT OffscreenCanvasRenderingContext2D final
bool hasAlpha() const final { return creationAttributes().alpha(); } bool hasAlpha() const final { return creationAttributes().alpha(); }
bool isContextLost() const override; bool isContextLost() const override;
ImageBitmap* transferToImageBitmap(ExceptionState&) final; ImageBitmap* transferToImageBitmap() final;
protected: protected:
OffscreenCanvasRenderingContext2D( OffscreenCanvasRenderingContext2D(
......
...@@ -102,8 +102,7 @@ void WebGL2RenderingContext::setOffscreenCanvasGetContextResult( ...@@ -102,8 +102,7 @@ void WebGL2RenderingContext::setOffscreenCanvasGetContextResult(
result.setWebGL2RenderingContext(this); result.setWebGL2RenderingContext(this);
} }
ImageBitmap* WebGL2RenderingContext::transferToImageBitmap( ImageBitmap* WebGL2RenderingContext::transferToImageBitmap() {
ExceptionState& exceptionState) {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
return nullptr; return nullptr;
} }
......
...@@ -39,7 +39,7 @@ class WebGL2RenderingContext : public WebGL2RenderingContextBase { ...@@ -39,7 +39,7 @@ class WebGL2RenderingContext : public WebGL2RenderingContextBase {
CanvasRenderingContext::ContextType getContextType() const override { CanvasRenderingContext::ContextType getContextType() const override {
return CanvasRenderingContext::ContextWebgl2; return CanvasRenderingContext::ContextWebgl2;
} }
ImageBitmap* transferToImageBitmap(ExceptionState&) final; ImageBitmap* transferToImageBitmap() final;
String contextName() const override { return "WebGL2RenderingContext"; } String contextName() const override { return "WebGL2RenderingContext"; }
void registerContextExtensions() override; void registerContextExtensions() override;
void setCanvasGetContextResult(RenderingContext&) final; void setCanvasGetContextResult(RenderingContext&) final;
......
...@@ -163,8 +163,7 @@ void WebGLRenderingContext::setOffscreenCanvasGetContextResult( ...@@ -163,8 +163,7 @@ void WebGLRenderingContext::setOffscreenCanvasGetContextResult(
result.setWebGLRenderingContext(this); result.setWebGLRenderingContext(this);
} }
ImageBitmap* WebGLRenderingContext::transferToImageBitmap( ImageBitmap* WebGLRenderingContext::transferToImageBitmap() {
ExceptionState& exceptionState) {
return transferToImageBitmapBase(); return transferToImageBitmapBase();
} }
......
...@@ -63,7 +63,7 @@ class WebGLRenderingContext final : public WebGLRenderingContextBase { ...@@ -63,7 +63,7 @@ class WebGLRenderingContext final : public WebGLRenderingContextBase {
CanvasRenderingContext::ContextType getContextType() const override { CanvasRenderingContext::ContextType getContextType() const override {
return CanvasRenderingContext::ContextWebgl; return CanvasRenderingContext::ContextWebgl;
} }
ImageBitmap* transferToImageBitmap(ExceptionState&) final; ImageBitmap* transferToImageBitmap() final;
String contextName() const override { return "WebGLRenderingContext"; } String contextName() const override { return "WebGLRenderingContext"; }
void registerContextExtensions() override; void registerContextExtensions() override;
void setCanvasGetContextResult(RenderingContext&) final; void setCanvasGetContextResult(RenderingContext&) final;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment