Reset count when clearing the hash map/set.

When calling `Clear` of the `Hashmap` or `Hashset` we'd remove all
entries but not reset `count_`. So, if you then called `IsEmpty` the map
would return false.

Bug: 428007402
Change-Id: I868f0936033b049328dfcb810fe9379d5613ce02
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/249315
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
diff --git a/src/tint/utils/containers/hashmap_base.h b/src/tint/utils/containers/hashmap_base.h
index 979fda2..0ef5abd 100644
--- a/src/tint/utils/containers/hashmap_base.h
+++ b/src/tint/utils/containers/hashmap_base.h
@@ -288,6 +288,7 @@
             }
             slots_[slot_idx].nodes = nullptr;
         }
+        count_ = 0;
     }
 
     /// Ensures that the map can hold @p n entries without heap reallocation or rehashing.
diff --git a/src/tint/utils/containers/hashmap_test.cc b/src/tint/utils/containers/hashmap_test.cc
index f3b91bd..4526d5d 100644
--- a/src/tint/utils/containers/hashmap_test.cc
+++ b/src/tint/utils/containers/hashmap_test.cc
@@ -462,6 +462,8 @@
             case 6: {  // Clear
                 reference.clear();
                 map.Clear();
+                ASSERT_TRUE(reference.empty());
+                ASSERT_TRUE(map.IsEmpty());
                 break;
             }
         }
diff --git a/src/tint/utils/containers/hashset_test.cc b/src/tint/utils/containers/hashset_test.cc
index e9ae39e..7cde440 100644
--- a/src/tint/utils/containers/hashset_test.cc
+++ b/src/tint/utils/containers/hashset_test.cc
@@ -141,6 +141,8 @@
             case 4: {  // Clear
                 reference.clear();
                 set.Clear();
+                ASSERT_TRUE(reference.empty());
+                ASSERT_TRUE(set.IsEmpty());
                 break;
             }
         }