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

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

Issue 2740003004: Check StaticBitmapImage has changed from Mailbox to Skia in OffscreenCanvas commit (Closed)
Patch Set: rebase Created 3 years, 9 months 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 a5fdbf58c48403a72d2860b631fcca4acb041a48..8cdbb05dc1246699d64a6776a91c745599992618 100644
--- a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
+++ b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
@@ -400,8 +400,22 @@ void OffscreenCanvasFrameDispatcherImpl::ReclaimResources(
const cc::ReturnedResourceArray& resources) {
for (const auto& resource : resources) {
RefPtr<StaticBitmapImage> image = m_cachedImages.at(resource.id);
- if (image)
- image->updateSyncToken(resource.sync_token);
+
+ if (image) {
+ if (image->hasMailbox()) {
+ image->updateSyncToken(resource.sync_token);
+ } else if (SharedGpuContext::isValid() && resource.sync_token.HasData()) {
+ // Although image has MailboxTextureHolder at the time when it is
+ // inserted to m_cachedImages, the
+ // OffscreenCanvasPlaceHolder::placeholderFrame() exposes this image to
+ // everyone accessing the placeholder canvas as an image source, some of
+ // which may want to consume the image as a SkImage, thereby converting
+ // the MailTextureHolder to a SkiaTextureHolder. In this case, we
+ // need to wait for the new sync token passed by CompositorFrameSink.
+ SharedGpuContext::gl()->WaitSyncTokenCHROMIUM(
+ resource.sync_token.GetConstData());
+ }
+ }
reclaimResource(resource.id);
}
}

Powered by Google App Engine
This is Rietveld 408576698