1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "PSMRunnable.h"
10 SyncRunnableBase::SyncRunnableBase()
11 : Runnable("psm::SyncRunnableBase"), monitor("SyncRunnableBase::monitor") {}
13 nsresult
SyncRunnableBase::DispatchToMainThreadAndWait() {
15 if (NS_IsMainThread()) {
19 mozilla::MonitorAutoLock
lock(monitor
);
20 rv
= NS_DispatchToMainThread(this);
21 if (NS_SUCCEEDED(rv
)) {
30 SyncRunnableBase::Run() {
32 mozilla::MonitorAutoLock(monitor
).Notify();
36 nsresult
NotifyObserverRunnable::Run() {
37 mObserver
->Observe(nullptr, mTopic
, nullptr);
42 } // namespace mozilla