mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Backed out 3 changesets (bug 1704887) for Gtest failures on a CLOSED TREE
Backed out changeset 211dcc933514 (bug 1704887) Backed out changeset bde076bfca7e (bug 1704887) Backed out changeset 34e875f85b88 (bug 1704887)
This commit is contained in:
parent
2e34e363b9
commit
bc7b15f9cf
@ -283,7 +283,7 @@ void nsStreamTransportService::OnDelayedRunnableRan(
|
||||
DelayedRunnable* aRunnable) {
|
||||
MOZ_ASSERT(IsOnCurrentThread());
|
||||
auto delayedRunnables = mScheduledDelayedRunnables.Lock();
|
||||
Unused << delayedRunnables->RemoveElement(aRunnable);
|
||||
MOZ_ALWAYS_TRUE(delayedRunnables->RemoveElement(aRunnable));
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsStreamTransportService, nsIStreamTransportService,
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "mozilla/DelayedRunnable.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "MediaTimer.h"
|
||||
#include "mozilla/media/MediaUtils.h"
|
||||
#include "VideoUtils.h"
|
||||
|
||||
@ -103,38 +102,3 @@ TEST(DelayedRunnable, nsThreadShutdownTask)
|
||||
nsIThread* t = thread.forget().take();
|
||||
Unused << t;
|
||||
}
|
||||
|
||||
TEST(DelayedRunnable, TimerFiresBeforeRunnableRuns)
|
||||
{
|
||||
RefPtr<SharedThreadPool> pool = SharedThreadPool::Get("Test Pool"_ns);
|
||||
auto tailTaskQueue1 = MakeRefPtr<TaskQueue>(
|
||||
do_AddRef(pool), /* aSupportsTailDispatch = */ true);
|
||||
auto tailTaskQueue2 = MakeRefPtr<TaskQueue>(
|
||||
do_AddRef(pool), /* aSupportsTailDispatch = */ true);
|
||||
auto noTailTaskQueue = MakeRefPtr<TaskQueue>(
|
||||
do_AddRef(pool), /* aSupportsTailDispatch = */ false);
|
||||
Monitor monitor(__func__);
|
||||
MonitorAutoLock lock(monitor);
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
tailTaskQueue1->Dispatch(NS_NewRunnableFunction(__func__, [&] {
|
||||
// This will tail dispatch the delayed runnable, making it prone to
|
||||
// lose a race against the directly-initiated timer firing (and
|
||||
// dispatching another non-tail-dispatched runnable).
|
||||
EXPECT_TRUE(tailTaskQueue1->RequiresTailDispatch(tailTaskQueue2));
|
||||
tailTaskQueue2->DelayedDispatch(
|
||||
NS_NewRunnableFunction(__func__, [&] {}), 1);
|
||||
MonitorAutoLock lock(monitor);
|
||||
auto timer = MakeRefPtr<MediaTimer>();
|
||||
timer->WaitFor(TimeDuration::FromMilliseconds(1), __func__)
|
||||
->Then(noTailTaskQueue, __func__, [&] {
|
||||
MonitorAutoLock lock(monitor);
|
||||
monitor.NotifyAll();
|
||||
});
|
||||
// Wait until the timer has run. It should have dispatched the
|
||||
// TimerEvent to tailTaskQueue2 by then. The tail dispatch happens when
|
||||
// we leave scope.
|
||||
monitor.Wait();
|
||||
})));
|
||||
// Wait for async steps before wrapping up the test case.
|
||||
monitor.Wait();
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ void TaskQueue::OnDelayedRunnableScheduled(DelayedRunnable* aRunnable) {
|
||||
|
||||
void TaskQueue::OnDelayedRunnableRan(DelayedRunnable* aRunnable) {
|
||||
MOZ_ASSERT(IsOnCurrentThread());
|
||||
Unused << mScheduledDelayedRunnables.RemoveElement(aRunnable);
|
||||
MOZ_ALWAYS_TRUE(mScheduledDelayedRunnables.RemoveElement(aRunnable));
|
||||
}
|
||||
|
||||
auto TaskQueue::CancelDelayedRunnables() -> RefPtr<CancelPromise> {
|
||||
|
@ -151,7 +151,7 @@ void ThreadEventTarget::OnDelayedRunnableScheduled(DelayedRunnable* aRunnable) {
|
||||
|
||||
void ThreadEventTarget::OnDelayedRunnableRan(DelayedRunnable* aRunnable) {
|
||||
MOZ_ASSERT(IsOnCurrentThread());
|
||||
Unused << mScheduledDelayedRunnables.RemoveElement(aRunnable);
|
||||
MOZ_ALWAYS_TRUE(mScheduledDelayedRunnables.RemoveElement(aRunnable));
|
||||
}
|
||||
|
||||
void ThreadEventTarget::NotifyShutdown() {
|
||||
|
Loading…
Reference in New Issue
Block a user