RefBase: remove implicit conversion to bool.

This helps push for comparing against nullptr more consistently.

Also replaces .Get() == nullptr and .Get() != nullptr with just ==
nullptr and != nullptr.

Bug: dawn:89
Change-Id: I884a4819f97305a73c11bad84391d1d2113ab7e2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/32922
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-18 09:10:22 +00:00
committed by Commit Bot service account
parent a0758a1aef
commit 55f251dffe
17 changed files with 33 additions and 47 deletions

View File

@@ -167,7 +167,7 @@ namespace dawn_native {
ASSERT(!IsError());
// Return the same current texture view until Present is called.
if (mCurrentTextureView.Get() != nullptr) {
if (mCurrentTextureView != nullptr) {
// Calling GetCurrentTextureView always returns a new reference so add it even when
// reuse the existing texture view.
mCurrentTextureView->Reference();
@@ -247,7 +247,7 @@ namespace dawn_native {
DAWN_TRY(GetDevice()->ValidateIsAlive());
DAWN_TRY(GetDevice()->ValidateObject(this));
if (mCurrentTextureView.Get() == nullptr) {
if (mCurrentTextureView == nullptr) {
return DAWN_VALIDATION_ERROR(
"Cannot call present without a GetCurrentTextureView call for this frame");
}
@@ -271,7 +271,7 @@ namespace dawn_native {
}
NewSwapChainBase::~NewSwapChainBase() {
if (mCurrentTextureView.Get() != nullptr) {
if (mCurrentTextureView != nullptr) {
ASSERT(mCurrentTextureView->GetTexture()->GetTextureState() ==
TextureBase::TextureState::Destroyed);
}
@@ -304,7 +304,7 @@ namespace dawn_native {
return TextureViewBase::MakeError(GetDevice());
}
if (mCurrentTextureView.Get() != nullptr) {
if (mCurrentTextureView != nullptr) {
// Calling GetCurrentTextureView always returns a new reference so add it even when
// reusing the existing texture view.
mCurrentTextureView->Reference();
@@ -384,7 +384,7 @@ namespace dawn_native {
return DAWN_VALIDATION_ERROR("Presenting on detached swapchain");
}
if (mCurrentTextureView.Get() == nullptr) {
if (mCurrentTextureView == nullptr) {
return DAWN_VALIDATION_ERROR("Presenting without prior GetCurrentTextureView");
}