Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(672)

Unified Diff: third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp

Issue 2455983005: Refactor AcceleratedStaticBitmapImage (Closed)
Patch Set: Keep a unique_ptr<WebGraphicsContext3DProvider>, otherwise crashes Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
index 2ce9f0bbcfb7f4cccaf455962e6fd103d629d297..970e6a6f35b3090e2c69ff0de021474c53bf8a36 100644
--- a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
+++ b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
@@ -136,8 +136,8 @@ void OffscreenCanvasFrameDispatcherImpl::
cc::TransferableResource& resource,
RefPtr<StaticBitmapImage> image) {
image->ensureMailbox();
- resource.mailbox_holder = gpu::MailboxHolder(
- image->getMailbox(), image->getSyncToken(), GL_TEXTURE_2D);
+ resource.mailbox_holder =
+ gpu::MailboxHolder(image->mailbox(), image->syncToken(), GL_TEXTURE_2D);
resource.read_lock_fences_enabled = false;
resource.is_software = false;
@@ -153,7 +153,7 @@ void OffscreenCanvasFrameDispatcherImpl::dispatchFrame(
called on SwiftShader. */) {
if (!image)
return;
- if (!verifyImageSize(image->imageForCurrentFrame()))
+ if (!verifyImageSize(image->size()))
return;
cc::CompositorFrame frame;
// TODO(crbug.com/652931): update the device_scale_factor
@@ -324,6 +324,9 @@ void OffscreenCanvasFrameDispatcherImpl::OnBeginFrame(
void OffscreenCanvasFrameDispatcherImpl::ReclaimResources(
const cc::ReturnedResourceArray& resources) {
for (const auto& resource : resources) {
+ RefPtr<StaticBitmapImage> image = m_cachedImages.get(resource.id);
+ if (image)
+ image->updateSyncToken(resource.sync_token);
m_cachedImages.remove(resource.id);
m_sharedBitmaps.remove(resource.id);
m_cachedTextureIds.remove(resource.id);
@@ -331,8 +334,8 @@ void OffscreenCanvasFrameDispatcherImpl::ReclaimResources(
}
bool OffscreenCanvasFrameDispatcherImpl::verifyImageSize(
- const sk_sp<SkImage>& image) {
- if (image && image->width() == m_width && image->height() == m_height)
+ const IntSize imageSize) {
+ if (imageSize.width() == m_width && imageSize.height() == m_height)
return true;
return false;
}

Powered by Google App Engine
This is Rietveld 408576698