|
@@ -0,0 +1,44 @@
|
|
|
|
+# HG changeset patch
|
|
|
|
+# User Jed Davis <jld@mozilla.com>
|
|
|
|
+# Date 1717640118 0
|
|
|
|
+# Node ID 2e7e4151f2716f71d9ce8be1171568bb38006ce3
|
|
|
|
+# Parent 98a0038cc3fc40333c026ef889af27636c1af9ab
|
|
|
|
+Bug 1837550 - Clean up control flow in WaitableEvent. r=nika, a=RyanVM
|
|
|
|
+
|
|
|
|
+Differential Revision: https://phabricator.services.mozilla.com/D212642
|
|
|
|
+
|
|
|
|
+diff --git a/ipc/chromium/src/base/waitable_event_posix.cc b/ipc/chromium/src/base/waitable_event_posix.cc
|
|
|
|
+--- a/ipc/chromium/src/base/waitable_event_posix.cc
|
|
|
|
++++ b/ipc/chromium/src/base/waitable_event_posix.cc
|
|
|
|
+@@ -86,25 +86,24 @@ class SyncWaiter : public WaitableEvent:
|
|
|
|
+ SyncWaiter(ConditionVariable* cv, Lock* lock)
|
|
|
|
+ : fired_(false),
|
|
|
|
+ cv_(cv),
|
|
|
|
+ lock_(lock),
|
|
|
|
+ signaling_event_(NULL) {
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ bool Fire(WaitableEvent *signaling_event) override {
|
|
|
|
+- lock_->Acquire();
|
|
|
|
+- const bool previous_value = fired_;
|
|
|
|
+- fired_ = true;
|
|
|
|
+- if (!previous_value)
|
|
|
|
+- signaling_event_ = signaling_event;
|
|
|
|
+- lock_->Release();
|
|
|
|
++ AutoLock locked(*lock_);
|
|
|
|
+
|
|
|
|
+- if (previous_value)
|
|
|
|
++ if (fired_) {
|
|
|
|
+ return false;
|
|
|
|
++ }
|
|
|
|
++
|
|
|
|
++ fired_ = true;
|
|
|
|
++ signaling_event_ = signaling_event;
|
|
|
|
+
|
|
|
|
+ cv_->Broadcast();
|
|
|
|
+
|
|
|
|
+ // SyncWaiters are stack allocated on the stack of the blocking thread.
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ WaitableEvent* signaled_event() const {
|