/src/mozilla-central/security/manager/ssl/PSMRunnable.cpp
Line | Count | Source (jump to first uncovered line) |
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/. */ |
4 | | |
5 | | #include "PSMRunnable.h" |
6 | | |
7 | | namespace mozilla { namespace psm { |
8 | | |
9 | | SyncRunnableBase::SyncRunnableBase() |
10 | | : Runnable("psm::SyncRunnableBase") |
11 | | , monitor("SyncRunnableBase::monitor") |
12 | 0 | { |
13 | 0 | } |
14 | | |
15 | | nsresult |
16 | | SyncRunnableBase::DispatchToMainThreadAndWait() |
17 | 0 | { |
18 | 0 | nsresult rv; |
19 | 0 | if (NS_IsMainThread()) { |
20 | 0 | RunOnTargetThread(); |
21 | 0 | rv = NS_OK; |
22 | 0 | } else { |
23 | 0 | mozilla::MonitorAutoLock lock(monitor); |
24 | 0 | rv = NS_DispatchToMainThread(this); |
25 | 0 | if (NS_SUCCEEDED(rv)) { |
26 | 0 | lock.Wait(); |
27 | 0 | } |
28 | 0 | } |
29 | 0 |
|
30 | 0 | return rv; |
31 | 0 | } |
32 | | |
33 | | NS_IMETHODIMP |
34 | | SyncRunnableBase::Run() |
35 | 0 | { |
36 | 0 | RunOnTargetThread(); |
37 | 0 | mozilla::MonitorAutoLock(monitor).Notify(); |
38 | 0 | return NS_OK; |
39 | 0 | } |
40 | | |
41 | | nsresult |
42 | | NotifyObserverRunnable::Run() |
43 | 0 | { |
44 | 0 | mObserver->Observe(nullptr, mTopic, nullptr); |
45 | 0 | return NS_OK; |
46 | 0 | } |
47 | | |
48 | | } } // namespace mozilla::psm |