D3D11: Avoid CommandRecordingContext's lock in CPU Buffer's mapping

CPU buffer doesn't need CommandRecordingContext so avoid acquiring its
lock in mapping functions.

Bug: chromium:422741977
Change-Id: I4c7c4186633cbee662f3246ba2243ed01d103afb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/285055
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
diff --git a/src/dawn/native/d3d11/BufferD3D11.cpp b/src/dawn/native/d3d11/BufferD3D11.cpp
index 3bbc8df..a9a859b 100644
--- a/src/dawn/native/d3d11/BufferD3D11.cpp
+++ b/src/dawn/native/d3d11/BufferD3D11.cpp
@@ -172,6 +172,20 @@
     ~UploadBuffer() override = default;
 
   private:
+    // BufferBase implementations
+    MaybeError MapAtCreationImpl() override {
+        mMappedData = mUploadData.get();
+        // MapAtCreation does the zeroization on the front-end side.
+        return {};
+    }
+
+    MaybeError MapAsyncImpl(wgpu::MapMode mode, size_t offset, size_t size) override {
+        mMappedData = mUploadData.get();
+        return EnsureDataInitialized(nullptr);
+    }
+    void UnmapImpl(BufferState oldState, BufferState newState) override { mMappedData = nullptr; }
+
+    // d3d11::Buffer implementations
     MaybeError InitializeInternal() override {
         mUploadData = std::unique_ptr<uint8_t[]>(AllocNoThrow<uint8_t>(GetAllocatedSize()));
         if (mUploadData == nullptr) {
@@ -180,15 +194,12 @@
         return {};
     }
 
-    MaybeError MapInternal(const ScopedCommandRecordingContext* commandContext,
-                           wgpu::MapMode) override {
+    MaybeError MapInternal(const ScopedCommandRecordingContext*, wgpu::MapMode) override {
         mMappedData = mUploadData.get();
         return {};
     }
 
-    void UnmapInternal(const ScopedCommandRecordingContext* commandContext) override {
-        mMappedData = nullptr;
-    }
+    void UnmapInternal(const ScopedCommandRecordingContext*) override { mMappedData = nullptr; }
 
     MaybeError ClearInternal(const ScopedCommandRecordingContext* commandContext,
                              uint8_t clearValue,