[Canvas] Eliminate MailboxSyncMode

Change the remaining usage to pass in a bool indicating whether a
verified sync token is needed, as this is all that this enum is used
for.

Bug: 352263194
Change-Id: Ib1b2d226cc876e1b8e06d6f73a602a1b0dc14b54
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5713037
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1328840}
diff --git a/third_party/blink/renderer/platform/graphics/canvas_resource.cc b/third_party/blink/renderer/platform/graphics/canvas_resource.cc
index 648e720..a14e1ad 100644
--- a/third_party/blink/renderer/platform/graphics/canvas_resource.cc
+++ b/third_party/blink/renderer/platform/graphics/canvas_resource.cc
@@ -165,7 +165,7 @@
 bool CanvasResource::PrepareTransferableResource(
     viz::TransferableResource* out_resource,
     CanvasResource::ReleaseCallback* out_callback,
-    MailboxSyncMode sync_mode) {
+    bool needs_verified_synctoken) {
   DCHECK(IsValid());
 
   DCHECK(out_callback);
@@ -182,7 +182,7 @@
   if (SupportsAcceleratedCompositing()) {
     return UsesClientSharedImage()
                ? PrepareAcceleratedTransferableResourceFromClientSI(
-                     out_resource, sync_mode)
+                     out_resource, needs_verified_synctoken)
                : PrepareAcceleratedTransferableResourceWithoutClientSI(
                      out_resource);
   }
@@ -191,7 +191,7 @@
 
 bool CanvasResource::PrepareAcceleratedTransferableResourceFromClientSI(
     viz::TransferableResource* out_resource,
-    MailboxSyncMode sync_mode) {
+    bool needs_verified_synctoken) {
   TRACE_EVENT0("blink",
                "CanvasResource::PrepareAcceleratedTransferableResource");
   // This method should only be called if this instance actually supports
@@ -210,9 +210,8 @@
 
   *out_resource = viz::TransferableResource::MakeGpu(
       client_shared_image->mailbox(), client_shared_image->GetTextureTarget(),
-      GetSyncToken(sync_mode == kVerifiedSyncToken), Size(),
-      GetSharedImageFormat(), IsOverlayCandidate(),
-      viz::TransferableResource::ResourceSource::kCanvas);
+      GetSyncToken(needs_verified_synctoken), Size(), GetSharedImageFormat(),
+      IsOverlayCandidate(), viz::TransferableResource::ResourceSource::kCanvas);
 
   out_resource->color_space = GetColorSpace();
   if (NeedsReadLockFences()) {
diff --git a/third_party/blink/renderer/platform/graphics/canvas_resource.h b/third_party/blink/renderer/platform/graphics/canvas_resource.h
index 5c2edf7..1f72db49 100644
--- a/third_party/blink/renderer/platform/graphics/canvas_resource.h
+++ b/third_party/blink/renderer/platform/graphics/canvas_resource.h
@@ -167,7 +167,7 @@
   // with the compositor.
   bool PrepareTransferableResource(viz::TransferableResource*,
                                    ReleaseCallback*,
-                                   MailboxSyncMode);
+                                   bool needs_verified_synctoken);
 
   // Issues a wait for this sync token on the context used by this resource for
   // rendering.
@@ -236,7 +236,7 @@
   // true.
   bool PrepareAcceleratedTransferableResourceFromClientSI(
       viz::TransferableResource* out_resource,
-      MailboxSyncMode);
+      bool needs_verified_synctoken);
 
   // Prepares GPU TransferableResource for resources for which
   // SupportsAcceleratedCompositing() is true but UsesClientSharedImage()
diff --git a/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.cc b/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.cc
index d9a7eea..a1e0c50 100644
--- a/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.cc
+++ b/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.cc
@@ -276,7 +276,8 @@
       canvas_resource->FilterQuality() == cc::PaintFlags::FilterQuality::kNone;
 
   canvas_resource->PrepareTransferableResource(
-      &resource, &frame_resource->release_callback, kVerifiedSyncToken);
+      &resource, &frame_resource->release_callback,
+      /*needs_verified_synctoken=*/true);
   const viz::ResourceId resource_id = next_resource_id;
   resource.id = resource_id;
 
diff --git a/third_party/blink/renderer/platform/graphics/canvas_resource_host.cc b/third_party/blink/renderer/platform/graphics/canvas_resource_host.cc
index f06364f..dc15a6df 100644
--- a/third_party/blink/renderer/platform/graphics/canvas_resource_host.cc
+++ b/third_party/blink/renderer/platform/graphics/canvas_resource_host.cc
@@ -231,7 +231,7 @@
 
   CanvasResource::ReleaseCallback release_callback;
   if (!frame->PrepareTransferableResource(out_resource, &release_callback,
-                                          kUnverifiedSyncToken) ||
+                                          /*needs_verified_synctoken=*/false) ||
       *out_resource == cc_layer_->current_transferable_resource()) {
     // If the resource did not change, the release will be handled correctly
     // when the callback from the previous frame is dispatched. But run the
diff --git a/third_party/blink/renderer/platform/graphics/canvas_resource_provider_test.cc b/third_party/blink/renderer/platform/graphics/canvas_resource_provider_test.cc
index 2790d59..be0fff3 100644
--- a/third_party/blink/renderer/platform/graphics/canvas_resource_provider_test.cc
+++ b/third_party/blink/renderer/platform/graphics/canvas_resource_provider_test.cc
@@ -233,7 +233,8 @@
   CanvasResource::ReleaseCallback release_callback;
   auto sync_token = resource->GetSyncToken(/*needs_verified_token=*/false);
   CHECK(resource->PrepareTransferableResource(
-      &transferable_resource, &release_callback, kUnverifiedSyncToken));
+      &transferable_resource, &release_callback,
+      /*needs_verified_synctoken=*/false));
   std::move(release_callback).Run(std::move(resource), sync_token, false);
 }
 
diff --git a/third_party/blink/renderer/platform/graphics/canvas_resource_test.cc b/third_party/blink/renderer/platform/graphics/canvas_resource_test.cc
index d9d71b0..744c3d0 100644
--- a/third_party/blink/renderer/platform/graphics/canvas_resource_test.cc
+++ b/third_party/blink/renderer/platform/graphics/canvas_resource_test.cc
@@ -31,7 +31,7 @@
   viz::TransferableResource resource;
   CanvasResource::ReleaseCallback release_callback;
   bool success = canvas_resource->PrepareTransferableResource(
-      &resource, &release_callback, kUnverifiedSyncToken);
+      &resource, &release_callback, /*needs_verified_synctoken=*/false);
 
   EXPECT_TRUE(success);
   EXPECT_TRUE(resource.is_software);
diff --git a/third_party/blink/renderer/platform/graphics/graphics_types.h b/third_party/blink/renderer/platform/graphics/graphics_types.h
index 74fc5d7..d66e265 100644
--- a/third_party/blink/renderer/platform/graphics/graphics_types.h
+++ b/third_party/blink/renderer/platform/graphics/graphics_types.h
@@ -158,12 +158,6 @@
   kPreferCPU,
 };
 
-enum MailboxSyncMode {
-  kVerifiedSyncToken,
-  kUnverifiedSyncToken,
-  kOrderingBarrier,
-};
-
 enum AntiAliasingMode { kNotAntiAliased, kAntiAliased };
 
 enum GradientSpreadMethod {