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

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

Issue 2455983005: Refactor AcceleratedStaticBitmapImage (Closed)
Patch Set: fix flickering 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 efb3d283d6114cdc0670bbf4a9ff828e2b0299f4..da55b6d0d15773a62630bc3e73ef878d72bbd9e9 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();
xidachen 2016/11/04 13:18:03 junov@: Then in here, we call 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
@@ -321,6 +321,9 @@ void OffscreenCanvasFrameDispatcherImpl::DidReceiveCompositorFrameAck() {
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);
@@ -328,8 +331,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