Move AcquireRef back to Ref.h
Bug: dawn:1769
Change-Id: I4299e83d9de14f42c323a3a04b0f0247bc509ae5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/149162
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/dawn/common/Ref.h b/src/dawn/common/Ref.h
index 9dd7dfb..3c93e24 100644
--- a/src/dawn/common/Ref.h
+++ b/src/dawn/common/Ref.h
@@ -39,6 +39,19 @@
} // namespace detail
template <typename T>
+class Ref : public RefBase<T*, detail::RefCountedTraits<T>> {
+ public:
+ using RefBase<T*, detail::RefCountedTraits<T>>::RefBase;
+};
+
+template <typename T>
+Ref<T> AcquireRef(T* pointee) {
+ Ref<T> ref;
+ ref.Acquire(pointee);
+ return ref;
+}
+
+template <typename T>
struct UnwrapRef {
using type = T;
};
@@ -56,12 +69,6 @@
static constexpr bool value = true;
};
-template <typename T>
-class Ref : public RefBase<T*, detail::RefCountedTraits<T>> {
- public:
- using RefBase<T*, detail::RefCountedTraits<T>>::RefBase;
-};
-
} // namespace dawn
#endif // SRC_DAWN_COMMON_REF_H_
diff --git a/src/dawn/common/RefCounted.h b/src/dawn/common/RefCounted.h
index 6971862..7040f94 100644
--- a/src/dawn/common/RefCounted.h
+++ b/src/dawn/common/RefCounted.h
@@ -46,19 +46,6 @@
std::atomic<uint64_t> mRefCount;
};
-// Forward declaration for Ref needed until TryGetRef can be removed with WeakRefs.
-// TODO(dawn:1769) Remove once WeakRef implementation is complete with cache.
-template <typename T>
-class Ref;
-
-// TODO(dawn:1769) Move to Ref.h once TryGetRef can be removed.
-template <typename T>
-Ref<T> AcquireRef(T* pointee) {
- Ref<T> ref;
- ref.Acquire(pointee);
- return ref;
-}
-
class RefCounted {
public:
explicit RefCounted(uint64_t payload = 0);