dawn::wire: Rename DestroyObjectCmd to UnregisterObjectCmd

This is to better reflect what it does as the object may not be
destroyed immediately, either in the client or the server.

Bug: 344963953
Change-Id: I82522fbb6021ad535b56c304082ee060f7475c62
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/197195
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
diff --git a/generator/templates/dawn/wire/server/ServerDoers.cpp b/generator/templates/dawn/wire/server/ServerDoers.cpp
index d67795b..d03dbbd 100644
--- a/generator/templates/dawn/wire/server/ServerDoers.cpp
+++ b/generator/templates/dawn/wire/server/ServerDoers.cpp
@@ -77,7 +77,7 @@
         {% endif %}
     {% endfor %}
 
-    WireResult Server::DoDestroyObject(ObjectType objectType, ObjectId objectId) {
+    WireResult Server::DoUnregisterObject(ObjectType objectType, ObjectId objectId) {
         switch(objectType) {
             {% for type in by_category["object"] %}
                 {% set cType = as_cType(type.name) %}
diff --git a/src/dawn/dawn_wire.json b/src/dawn/dawn_wire.json
index 548e6b2..6fb0cbb 100644
--- a/src/dawn/dawn_wire.json
+++ b/src/dawn/dawn_wire.json
@@ -75,7 +75,7 @@
             { "name": "event manager handle", "type": "ObjectHandle" },
             { "name": "future", "type": "future" }
         ],
-        "destroy object": [
+        "unregister object": [
             { "name": "object type", "type": "ObjectType" },
             { "name": "object id", "type": "ObjectId" }
         ],
diff --git a/src/dawn/wire/client/Client.cpp b/src/dawn/wire/client/Client.cpp
index a24445b..35c2aed 100644
--- a/src/dawn/wire/client/Client.cpp
+++ b/src/dawn/wire/client/Client.cpp
@@ -65,17 +65,17 @@
         eventManager->TransitionTo(EventManager::State::ClientDropped);
     }
 
-    DestroyAllObjects();
+    UnregisterAllObjects();
 }
 
-void Client::DestroyAllObjects() {
+void Client::UnregisterAllObjects() {
     // Free all devices first since they may hold references to other objects
     // like the default queue. The Device destructor releases the default queue,
     // which would be invalid if the queue was already freed.
     while (!mObjects[ObjectType::Device].empty()) {
         ObjectBase* object = mObjects[ObjectType::Device].head()->value();
 
-        DestroyObjectCmd cmd;
+        UnregisterObjectCmd cmd;
         cmd.objectType = ObjectType::Device;
         cmd.objectId = object->GetWireId();
         SerializeCommand(cmd);
@@ -90,7 +90,7 @@
         while (!objectList.empty()) {
             ObjectBase* object = objectList.head()->value();
 
-            DestroyObjectCmd cmd;
+            UnregisterObjectCmd cmd;
             cmd.objectType = objectType;
             cmd.objectId = object->GetWireId();
             SerializeCommand(cmd);
diff --git a/src/dawn/wire/client/Client.h b/src/dawn/wire/client/Client.h
index af8191b..e382f40 100644
--- a/src/dawn/wire/client/Client.h
+++ b/src/dawn/wire/client/Client.h
@@ -114,7 +114,7 @@
     bool IsDisconnected() const;
 
   private:
-    void DestroyAllObjects();
+    void UnregisterAllObjects();
 
     template <typename T>
     void Free(T* obj) {
diff --git a/src/dawn/wire/client/ObjectBase.cpp b/src/dawn/wire/client/ObjectBase.cpp
index 14a9f27..6480b86 100644
--- a/src/dawn/wire/client/ObjectBase.cpp
+++ b/src/dawn/wire/client/ObjectBase.cpp
@@ -64,7 +64,7 @@
 
     uint32_t refCount = --mRefcount;
     if (refCount == 0) {
-        DestroyObjectCmd cmd;
+        UnregisterObjectCmd cmd;
         cmd.objectType = GetObjectType();
         cmd.objectId = GetWireId();
 
diff --git a/src/dawn/wire/server/Server.cpp b/src/dawn/wire/server/Server.cpp
index bc6b6c2..a443608 100644
--- a/src/dawn/wire/server/Server.cpp
+++ b/src/dawn/wire/server/Server.cpp
@@ -167,7 +167,7 @@
     // free their userdata. Also unlike other callbacks, these are cleared and unset when
     // the server is destroyed, so we don't need to check if the server is still alive
     // inside them.
-    // Also, the device is special-cased in Server::DoDestroyObject to call
+    // Also, the device is special-cased in Server::DoUnregisterObject to call
     // ClearDeviceCallbacks. This ensures that callbacks will not fire after |deviceObject|
     // is freed.