Metal: Wrap NS classes and protocols in NSRef.

This makes refcounting of these objects more automatic to try and
prevent leaks or use-after-frees in the future.

Also removes operator* from RefBase (and Ref) because it is never used
and cannot work in a normal way for ObjectiveC protocols that cannot be
dereferenced.

Bug: dawn:89

Change-Id: I2e3fbfd638e2ba76d8c563f30bc489a384152552
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/32161
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez
2020-11-16 23:07:56 +00:00
committed by Commit Bot service account
parent 1805e46a15
commit 0055d95fa7
30 changed files with 462 additions and 346 deletions

View File

@@ -118,7 +118,6 @@ TEST(Ref, Gets) {
test->Release();
EXPECT_EQ(test.Get(), original);
EXPECT_EQ(&*test, original);
EXPECT_EQ(test->GetThis(), original);
}
@@ -127,7 +126,6 @@ TEST(Ref, DefaultsToNull) {
Ref<RCTest> test;
EXPECT_EQ(test.Get(), nullptr);
EXPECT_EQ(&*test, nullptr);
EXPECT_EQ(test->GetThis(), nullptr);
}