[dawn] Try to fix raw_ptr usage in DynamicLib Bug: 486928687, 485825675 Change-Id: I29776ff5380ecd5849c592cb9872fa0c280c0da1 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/293095 Reviewed-by: Peter McNeeley <petermcneeley@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com> Commit-Queue: Peter McNeeley <petermcneeley@google.com>
diff --git a/src/dawn/common/DynamicLib.h b/src/dawn/common/DynamicLib.h index 4b8fdfd..98ba1aa 100644 --- a/src/dawn/common/DynamicLib.h +++ b/src/dawn/common/DynamicLib.h
@@ -34,7 +34,14 @@ #include "dawn/common/Assert.h" #include "dawn/common/Platform.h" + +#if DAWN_PLATFORM_IS(WINDOWS) #include "partition_alloc/pointers/raw_ptr.h" +#elif DAWN_PLATFORM_IS(POSIX) +#include "partition_alloc/pointers/raw_ptr_exclusion.h" +#else +#error "Unsupported platform for DynamicLib" +#endif namespace dawn { @@ -73,8 +80,18 @@ } private: - // TODO(crbug.com/485825675): Investigate why this pointer is dangling. - raw_ptr<void, DanglingUntriaged> mHandle = nullptr; +#if DAWN_PLATFORM_IS(WINDOWS) + // This is an HMODULE (aka void*). It should point to real memory, so we can use raw_ptr: + // > A handle to a module. This is the base address of the module in memory. + raw_ptr<void> mHandle = nullptr; +#elif DAWN_PLATFORM_IS(POSIX) + // On POSIX we use `dlopen`, which returns a "handle" which may not be a real pointer: + // > The value of this symbol table handle should not be interpreted in any way by the caller. + RAW_PTR_EXCLUSION void* mHandle = nullptr; +#else +#error "Unsupported platform for DynamicLib" +#endif + bool mNeedsClose = false; };