Commit faacc850 authored by Justin Novosad's avatar Justin Novosad Committed by Commit Bot

Remove virtual calls from CanvasResource destructors.

BUG=790699

Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I432ad3103df1d07732b2629384dc074cb6002a21
Reviewed-on: https://chromium-review.googlesource.com/806692Reviewed-by: default avatarOlivia Lai <xlai@chromium.org>
Commit-Queue: Justin Novosad <junov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521741}
parent cfe4f098
...@@ -85,7 +85,7 @@ bool CanvasResource_Skia::IsValid() const { ...@@ -85,7 +85,7 @@ bool CanvasResource_Skia::IsValid() const {
return !!context_provider_wrapper_; return !!context_provider_wrapper_;
} }
void CanvasResource_Skia::Abandon() { void CanvasResource_Skia::TearDown() {
WaitSyncTokenBeforeRelease(); WaitSyncTokenBeforeRelease();
auto gl = ContextGL(); auto gl = ContextGL();
if (gl && HasGpuMailbox()) { if (gl && HasGpuMailbox()) {
...@@ -147,7 +147,7 @@ CanvasResource_GpuMemoryBuffer::CanvasResource_GpuMemoryBuffer( ...@@ -147,7 +147,7 @@ CanvasResource_GpuMemoryBuffer::CanvasResource_GpuMemoryBuffer(
} }
CanvasResource_GpuMemoryBuffer::~CanvasResource_GpuMemoryBuffer() { CanvasResource_GpuMemoryBuffer::~CanvasResource_GpuMemoryBuffer() {
Abandon(); TearDown();
} }
scoped_refptr<CanvasResource_GpuMemoryBuffer> scoped_refptr<CanvasResource_GpuMemoryBuffer>
...@@ -164,7 +164,7 @@ CanvasResource_GpuMemoryBuffer::Create( ...@@ -164,7 +164,7 @@ CanvasResource_GpuMemoryBuffer::Create(
return nullptr; return nullptr;
} }
void CanvasResource_GpuMemoryBuffer::Abandon() { void CanvasResource_GpuMemoryBuffer::TearDown() {
WaitSyncTokenBeforeRelease(); WaitSyncTokenBeforeRelease();
if (!context_provider_wrapper_ || !image_id_) if (!context_provider_wrapper_ || !image_id_)
return; return;
......
...@@ -52,16 +52,17 @@ class PLATFORM_EXPORT CanvasResource_Skia final : public CanvasResource { ...@@ -52,16 +52,17 @@ class PLATFORM_EXPORT CanvasResource_Skia final : public CanvasResource {
static scoped_refptr<CanvasResource_Skia> Create( static scoped_refptr<CanvasResource_Skia> Create(
sk_sp<SkImage>, sk_sp<SkImage>,
base::WeakPtr<WebGraphicsContext3DProviderWrapper>); base::WeakPtr<WebGraphicsContext3DProviderWrapper>);
virtual ~CanvasResource_Skia() { Abandon(); } virtual ~CanvasResource_Skia() { TearDown(); }
// Not recyclable: Skia handles texture recycling internally and bitmaps are // Not recyclable: Skia handles texture recycling internally and bitmaps are
// cheap to allocate. // cheap to allocate.
bool IsRecycleable() const final { return false; } bool IsRecycleable() const final { return false; }
bool IsValid() const final; bool IsValid() const final;
void Abandon() final; void Abandon() final { TearDown(); }
GLuint TextureId() const final; GLuint TextureId() const final;
private: private:
void TearDown();
CanvasResource_Skia(sk_sp<SkImage>, CanvasResource_Skia(sk_sp<SkImage>,
base::WeakPtr<WebGraphicsContext3DProviderWrapper>); base::WeakPtr<WebGraphicsContext3DProviderWrapper>);
...@@ -79,10 +80,11 @@ class PLATFORM_EXPORT CanvasResource_GpuMemoryBuffer final ...@@ -79,10 +80,11 @@ class PLATFORM_EXPORT CanvasResource_GpuMemoryBuffer final
virtual ~CanvasResource_GpuMemoryBuffer(); virtual ~CanvasResource_GpuMemoryBuffer();
bool IsRecycleable() const final { return IsValid(); } bool IsRecycleable() const final { return IsValid(); }
bool IsValid() const { return context_provider_wrapper_ && image_id_; } bool IsValid() const { return context_provider_wrapper_ && image_id_; }
void Abandon() final; void Abandon() final { TearDown(); }
GLuint TextureId() const final { return texture_id_; } GLuint TextureId() const final { return texture_id_; }
private: private:
void TearDown();
CanvasResource_GpuMemoryBuffer( CanvasResource_GpuMemoryBuffer(
const IntSize&, const IntSize&,
const CanvasColorParams&, const CanvasColorParams&,
......
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