mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 05:27:49 +00:00
dawncpp.h: Add nullptr ObjectBase constructor and assignment
BUG=dawn:3 Change-Id: I9f7ec0ae1c7885809888a603ed056c6565751bec Reviewed-on: https://dawn-review.googlesource.com/c/2840 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Stephen White <senorblanco@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
f0b761f116
commit
f48e6b74b7
@@ -97,6 +97,15 @@ namespace dawn {
|
||||
return static_cast<Derived&>(*this);
|
||||
}
|
||||
|
||||
ObjectBase(nullptr_t) {}
|
||||
Derived& operator=(nullptr_t) {
|
||||
if (mHandle != nullptr) {
|
||||
Derived::DawnRelease(mHandle);
|
||||
mHandle = nullptr;
|
||||
}
|
||||
return static_cast<Derived&>(*this);
|
||||
}
|
||||
|
||||
explicit operator bool() const {
|
||||
return mHandle != nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user