Commit f4cbb65e authored by Khushal Sagar's avatar Khushal Sagar Committed by Commit Bot

blink/canvas: Don't verify sync tokens when generating snapshots.

Verification is expensive because of the need for sync IPCs and
unnecessary unless resources are shared across processes. This was
inadvertently added for cases where the resource is used within the same
process, for instance a canvas to canvas draw.

R=sunnyps@chromium.org

Bug: 1131916
Change-Id: I54dcf298f185928faaa5a9caa9198b3815b6fa8c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2432859
Commit-Queue: Khushal <khushalsagar@chromium.org>
Reviewed-by: default avatarSunny Sachanandani <sunnyps@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811492}
parent d09dee98
......@@ -627,6 +627,9 @@ scoped_refptr<StaticBitmapImage> CanvasResourceRasterSharedImage::Bitmap() {
scoped_refptr<StaticBitmapImage> image;
// If its cross thread, then the sync token was already verified.
if (!is_cross_thread()) {
owning_thread_data().mailbox_sync_mode = kUnverifiedSyncToken;
}
image = AcceleratedStaticBitmapImage::CreateFromCanvasMailbox(
mailbox(), GetSyncToken(), texture_id_for_image, image_info, texture_target_,
is_origin_top_left_, context_provider_wrapper_, owning_thread_ref_,
......@@ -952,13 +955,14 @@ scoped_refptr<StaticBitmapImage> CanvasResourceSkiaDawnSharedImage::Bitmap() {
scoped_refptr<StaticBitmapImage> image;
// If its cross thread, then the sync token was already verified. If not, then
// we don't need one. The image lazily generates a token if needed.
gpu::SyncToken token = is_cross_thread() ? sync_token() : gpu::SyncToken();
// If its cross thread, then the sync token was already verified.
if (!is_cross_thread()) {
owning_thread_data().mailbox_sync_mode = kUnverifiedSyncToken;
}
image = AcceleratedStaticBitmapImage::CreateFromCanvasMailbox(
mailbox(), token, 0, image_info, GL_TEXTURE_2D, is_origin_top_left_,
context_provider_wrapper_, owning_thread_ref_, owning_thread_task_runner_,
std::move(release_callback));
mailbox(), GetSyncToken(), 0, image_info, GL_TEXTURE_2D,
is_origin_top_left_, context_provider_wrapper_, owning_thread_ref_,
owning_thread_task_runner_, std::move(release_callback));
DCHECK(image);
return image;
......
......@@ -339,7 +339,7 @@ class PLATFORM_EXPORT CanvasResourceRasterSharedImage final
gpu::Mailbox shared_image_mailbox;
gpu::SyncToken sync_token;
size_t bitmap_image_read_refs = 0u;
MailboxSyncMode mailbox_sync_mode = kVerifiedSyncToken;
MailboxSyncMode mailbox_sync_mode = kUnverifiedSyncToken;
bool is_lost = false;
// We need to create 2 representations if canvas is operating in single
......@@ -478,7 +478,7 @@ class PLATFORM_EXPORT CanvasResourceSkiaDawnSharedImage final
GLuint id;
GLuint generation;
size_t bitmap_image_read_refs = 0u;
MailboxSyncMode mailbox_sync_mode = kVerifiedSyncToken;
MailboxSyncMode mailbox_sync_mode = kUnverifiedSyncToken;
bool is_lost = false;
};
......
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