[dawn] Update thread annotations for other threading objects.
- Adds the threading annotations to DeviceMutex and Guard. This
was otherwise causing build failures when rolling into google3.
Change-Id: I9a252bc225e4e07d0af7c14873a8312f8975c8c5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/256534
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Auto-Submit: Loko Kung <lokokung@google.com>
diff --git a/src/dawn/common/MutexProtected.h b/src/dawn/common/MutexProtected.h
index c922ea7..82da884 100644
--- a/src/dawn/common/MutexProtected.h
+++ b/src/dawn/common/MutexProtected.h
@@ -31,6 +31,7 @@
#include <mutex>
#include <utility>
+#include "dawn/common/Compiler.h"
#include "dawn/common/Defer.h"
#include "dawn/common/Mutex.h"
#include "dawn/common/NonMovable.h"
@@ -87,7 +88,7 @@
// Guard class is a wrapping class that gives access to a protected resource after acquiring the
// lock related to it. For the lifetime of this class, the lock is held.
template <typename T, typename Traits>
-class Guard : public NonMovable, StackAllocated {
+class DAWN_SCOPED_LOCKABLE Guard : public NonMovable, StackAllocated {
public:
// It's the programmer's burden to not save the pointer/reference and reuse it without the lock.
auto* operator->() const { return Get(); }
diff --git a/src/dawn/native/DeviceGuard.h b/src/dawn/native/DeviceGuard.h
index fb71d07..441ba18 100644
--- a/src/dawn/native/DeviceGuard.h
+++ b/src/dawn/native/DeviceGuard.h
@@ -31,6 +31,7 @@
#include <mutex>
#include <optional>
+#include "dawn/common/Compiler.h"
#include "dawn/common/Defer.h"
#include "dawn/common/MutexProtected.h"
#include "dawn/common/Ref.h"
@@ -47,8 +48,8 @@
friend class DeviceBase;
friend struct AutoLockBase<DeviceMutex*>;
- void Lock();
- void Unlock();
+ void Lock() DAWN_EXCLUSIVE_LOCK_FUNCTION;
+ void Unlock() DAWN_UNLOCK_FUNCTION;
uint32_t mRecursionStackDepth = 0;
std::optional<class Defer> mDefer = std::nullopt;