[dawn][wire] Removes remaining references to RequestTracker.

Bug: dawn:2060
Change-Id: Ic12be40a7cfa6a727c101dccda7802d22c6f2b57
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/175950
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
diff --git a/src/dawn/wire/BUILD.gn b/src/dawn/wire/BUILD.gn
index 8b8629d..468408a 100644
--- a/src/dawn/wire/BUILD.gn
+++ b/src/dawn/wire/BUILD.gn
@@ -128,7 +128,6 @@
     "client/QuerySet.h",
     "client/Queue.cpp",
     "client/Queue.h",
-    "client/RequestTracker.h",
     "client/ShaderModule.cpp",
     "client/ShaderModule.h",
     "client/Surface.cpp",
diff --git a/src/dawn/wire/CMakeLists.txt b/src/dawn/wire/CMakeLists.txt
index 854dd7a..2811e0c 100644
--- a/src/dawn/wire/CMakeLists.txt
+++ b/src/dawn/wire/CMakeLists.txt
@@ -88,7 +88,6 @@
     "client/QuerySet.h"
     "client/Queue.cpp"
     "client/Queue.h"
-    "client/RequestTracker.h"
     "client/ShaderModule.cpp"
     "client/ShaderModule.h"
     "client/Surface.cpp"
diff --git a/src/dawn/wire/client/Adapter.cpp b/src/dawn/wire/client/Adapter.cpp
index 3acb249..3d3e367 100644
--- a/src/dawn/wire/client/Adapter.cpp
+++ b/src/dawn/wire/client/Adapter.cpp
@@ -103,20 +103,6 @@
 
 }  // anonymous namespace
 
-Adapter::~Adapter() {
-    mRequestDeviceRequests.CloseAll([](RequestDeviceData* request) {
-        request->callback(WGPURequestDeviceStatus_Unknown, nullptr,
-                          "Adapter destroyed before callback", request->userdata);
-    });
-}
-
-void Adapter::CancelCallbacksForDisconnect() {
-    mRequestDeviceRequests.CloseAll([](RequestDeviceData* request) {
-        request->callback(WGPURequestDeviceStatus_Unknown, nullptr, "GPU connection lost",
-                          request->userdata);
-    });
-}
-
 ObjectType Adapter::GetObjectType() const {
     return ObjectType::Adapter;
 }
diff --git a/src/dawn/wire/client/Adapter.h b/src/dawn/wire/client/Adapter.h
index b6c0100..2ff6795 100644
--- a/src/dawn/wire/client/Adapter.h
+++ b/src/dawn/wire/client/Adapter.h
@@ -35,7 +35,6 @@
 #include "dawn/wire/WireCmd_autogen.h"
 #include "dawn/wire/client/LimitsAndFeatures.h"
 #include "dawn/wire/client/ObjectBase.h"
-#include "dawn/wire/client/RequestTracker.h"
 #include "partition_alloc/pointers/raw_ptr.h"
 
 namespace dawn::wire::client {
@@ -43,9 +42,7 @@
 class Adapter final : public ObjectWithEventsBase {
   public:
     using ObjectWithEventsBase::ObjectWithEventsBase;
-    ~Adapter() override;
 
-    void CancelCallbacksForDisconnect() override;
     ObjectType GetObjectType() const override;
 
     bool GetLimits(WGPUSupportedLimits* limits) const;
@@ -70,14 +67,6 @@
     WGPUAdapterProperties mProperties;
     std::vector<WGPUMemoryHeapInfo> mMemoryHeapInfo;
     WGPUAdapterPropertiesD3D mD3DProperties;
-
-    struct RequestDeviceData {
-        WGPURequestDeviceCallback callback = nullptr;
-        ObjectId deviceObjectId;
-        // TODO(https://crbug.com/dawn/2345): Investigate `DanglingUntriaged` in dawn/wire.
-        raw_ptr<void, DanglingUntriaged> userdata = nullptr;
-    };
-    RequestTracker<RequestDeviceData> mRequestDeviceRequests;
 };
 
 void ClientAdapterPropertiesFreeMembers(WGPUAdapterProperties);
diff --git a/src/dawn/wire/client/Device.h b/src/dawn/wire/client/Device.h
index a04baf1..9b081f1 100644
--- a/src/dawn/wire/client/Device.h
+++ b/src/dawn/wire/client/Device.h
@@ -36,7 +36,6 @@
 #include "dawn/wire/client/ApiObjects_autogen.h"
 #include "dawn/wire/client/LimitsAndFeatures.h"
 #include "dawn/wire/client/ObjectBase.h"
-#include "dawn/wire/client/RequestTracker.h"
 #include "partition_alloc/pointers/raw_ptr.h"
 
 namespace dawn::wire::client {
diff --git a/src/dawn/wire/client/Instance.h b/src/dawn/wire/client/Instance.h
index def6f24..3963fc8 100644
--- a/src/dawn/wire/client/Instance.h
+++ b/src/dawn/wire/client/Instance.h
@@ -33,7 +33,6 @@
 #include "dawn/wire/WireClient.h"
 #include "dawn/wire/WireCmd_autogen.h"
 #include "dawn/wire/client/ObjectBase.h"
-#include "dawn/wire/client/RequestTracker.h"
 
 namespace dawn::wire::client {
 
diff --git a/src/dawn/wire/client/Queue.h b/src/dawn/wire/client/Queue.h
index 405fd04..6708c03 100644
--- a/src/dawn/wire/client/Queue.h
+++ b/src/dawn/wire/client/Queue.h
@@ -32,7 +32,6 @@
 
 #include "dawn/wire/WireClient.h"
 #include "dawn/wire/client/ObjectBase.h"
-#include "dawn/wire/client/RequestTracker.h"
 
 namespace dawn::wire::client {
 
diff --git a/src/dawn/wire/client/RequestTracker.h b/src/dawn/wire/client/RequestTracker.h
deleted file mode 100644
index 6a19c93..0000000
--- a/src/dawn/wire/client/RequestTracker.h
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2021 The Dawn & Tint Authors
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its
-//    contributors may be used to endorse or promote products derived from
-//    this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef SRC_DAWN_WIRE_CLIENT_REQUESTTRACKER_H_
-#define SRC_DAWN_WIRE_CLIENT_REQUESTTRACKER_H_
-
-#include <cstdint>
-#include <map>
-#include <utility>
-
-#include "dawn/common/Assert.h"
-#include "dawn/common/NonCopyable.h"
-
-namespace dawn::wire::client {
-
-class Device;
-class MemoryTransferService;
-
-template <typename Request>
-class RequestTracker : NonCopyable {
-  public:
-    ~RequestTracker() { DAWN_ASSERT(mRequests.empty()); }
-
-    uint64_t Add(Request&& request) {
-        mSerial++;
-        mRequests.emplace(mSerial, request);
-        return mSerial;
-    }
-
-    bool Acquire(uint64_t serial, Request* request) {
-        auto it = mRequests.find(serial);
-        if (it == mRequests.end()) {
-            return false;
-        }
-        *request = std::move(it->second);
-        mRequests.erase(it);
-        return true;
-    }
-
-    template <typename CloseFunc>
-    void CloseAll(CloseFunc&& closeFunc) {
-        // Call closeFunc on all requests while handling reentrancy where the callback of some
-        // requests may add some additional requests. We guarantee all callbacks for requests
-        // are called exactly onces, so keep closing new requests if the first batch added more.
-        // It is fine to loop infinitely here if that's what the application makes use do.
-        while (!mRequests.empty()) {
-            // Move mRequests to a local variable so that further reentrant modifications of
-            // mRequests don't invalidate the iterators.
-            auto allRequests = std::move(mRequests);
-            for (auto& [_, request] : allRequests) {
-                closeFunc(&request);
-            }
-        }
-    }
-
-    template <typename F>
-    void ForAll(F&& f) {
-        for (auto& [_, request] : mRequests) {
-            f(&request);
-        }
-    }
-
-  private:
-    uint64_t mSerial = 0;
-    std::map<uint64_t, Request> mRequests;
-};
-
-}  // namespace dawn::wire::client
-
-#endif  // SRC_DAWN_WIRE_CLIENT_REQUESTTRACKER_H_