[Blink] Eliminate OffscreenCanvasRC2D constructor ResourceProvider calls

The OffscreenCanvas cannot have a ResourceProvider at this point, as
the OffscreenCanvas' resource provider will get created only via calls
from OffscreenCanvasRenderingContext2D itself that happen
post-construction of the latter object (this is verified by the fact
that OffscreenCanvas::GetOrCreateResourceProviderForCanvas2D() CHECKs
that the context type is 2D, which is a CHECK that will succeed only
after the context object is returned from construction and installed in
the host).

The DidDraw() call that the checks are guarding seems to have lost
relevance in any case; at some point in the past we cleared the canvas
in the OffScreenCanvasRC2D constructor (e.g., [1] shows this, although
the clearing code predates that CL), but we no longer do so.

[1] https://chromium-review.googlesource.com/c/chromium/src/+/1915284

Bug: 352263194
Change-Id: Ifa4082329db7178ab0070817688bca374ac05dc2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6633610
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1473436}
diff --git a/third_party/blink/renderer/modules/canvas/offscreencanvas2d/offscreen_canvas_rendering_context_2d.cc b/third_party/blink/renderer/modules/canvas/offscreencanvas2d/offscreen_canvas_rendering_context_2d.cc
index 200078e..b92fc55 100644
--- a/third_party/blink/renderer/modules/canvas/offscreencanvas2d/offscreen_canvas_rendering_context_2d.cc
+++ b/third_party/blink/renderer/modules/canvas/offscreencanvas2d/offscreen_canvas_rendering_context_2d.cc
@@ -105,15 +105,6 @@
       canvas->GetTopExecutionContext());
   is_valid_size_ = Host()->IsValidImageSize();
 
-  // Clear the background transparent or opaque.
-
-  // NOTE: At this point the canvas has no context installed yet and hence it is
-  // not possible to go through GetResourceProviderForCanvas2D() on it, which
-  // asserts that the context is present and is Canvas2D.
-  if (canvas->ResourceProvider() && canvas->ResourceProvider()->IsValid()) {
-    DidDraw(CanvasPerformanceMonitor::DrawType::kOther);
-  }
-
   ExecutionContext* execution_context = canvas->GetTopExecutionContext();
   if (auto* window = DynamicTo<LocalDOMWindow>(execution_context)) {
     if (window->GetFrame() && window->GetFrame()->GetSettings() &&