diff --git a/mojo/edk/system/watcher_dispatcher.cc b/mojo/edk/system/watcher_dispatcher.cc index db43843dd83ae5..5bd60e5f5714df 100644 --- a/mojo/edk/system/watcher_dispatcher.cc +++ b/mojo/edk/system/watcher_dispatcher.cc @@ -8,6 +8,7 @@ #include #include +#include "base/debug/alias.h" #include "base/macros.h" #include "base/memory/ptr_util.h" #include "mojo/edk/system/watch.h" @@ -25,6 +26,11 @@ void WatcherDispatcher::NotifyHandleState(Dispatcher* dispatcher, if (it == watched_handles_.end()) return; + // TODO(crbug.com/740044): Remove this. + uint32_t sentinel = sentinel_value_for_debugging_; + base::debug::Alias(&sentinel); + CHECK_EQ(0x12345678u, sentinel); + // Maybe fire a notification to the watch associated with this dispatcher, // provided we're armed and it cares about the new state. if (it->second->NotifyState(state, armed_)) { @@ -53,6 +59,11 @@ void WatcherDispatcher::NotifyHandleClosed(Dispatcher* dispatcher) { watched_handles_.erase(it); } + // TODO(crbug.com/740044): Remove this. + uint32_t sentinel = sentinel_value_for_debugging_; + base::debug::Alias(&sentinel); + CHECK_EQ(0x12345678u, sentinel); + // NOTE: It's important that this is called outside of |lock_| since it // acquires internal Watch locks. watch->Cancel(); @@ -174,6 +185,11 @@ MojoResult WatcherDispatcher::CancelWatch(uintptr_t context) { watches_.erase(it); } + // TODO(crbug.com/740044): Remove this. + uint32_t sentinel = sentinel_value_for_debugging_; + base::debug::Alias(&sentinel); + CHECK_EQ(0x12345678u, sentinel); + // Mark the watch as cancelled so no further notifications get through. watch->Cancel(); @@ -253,7 +269,10 @@ MojoResult WatcherDispatcher::Arm( return MOJO_RESULT_FAILED_PRECONDITION; } -WatcherDispatcher::~WatcherDispatcher() = default; +WatcherDispatcher::~WatcherDispatcher() { + // TODO(crbug.com/740044): Remove this. + sentinel_value_for_debugging_ = 0x87654321; +} } // namespace edk } // namespace mojo diff --git a/mojo/edk/system/watcher_dispatcher.h b/mojo/edk/system/watcher_dispatcher.h index 0c5f25520260d5..6a28d294a6227a 100644 --- a/mojo/edk/system/watcher_dispatcher.h +++ b/mojo/edk/system/watcher_dispatcher.h @@ -5,6 +5,8 @@ #ifndef MOJO_EDK_SYSTEM_WATCHER_DISPATCHER_H_ #define MOJO_EDK_SYSTEM_WATCHER_DISPATCHER_H_ +#include + #include #include @@ -93,6 +95,9 @@ class WatcherDispatcher : public Dispatcher { // an invalid object. It must therefore never be dereferenced. const Watch* last_watch_to_block_arming_ = nullptr; + // TODO(crbug.com/740044): Remove this. + uint32_t sentinel_value_for_debugging_ = 0x12345678; + DISALLOW_COPY_AND_ASSIGN(WatcherDispatcher); };