/src/mozilla-central/gfx/ipc/VsyncIOThreadHolder.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #include "VsyncIOThreadHolder.h" |
8 | | |
9 | | #include "mozilla/SystemGroup.h" |
10 | | |
11 | | namespace mozilla { |
12 | | namespace gfx { |
13 | | |
14 | | VsyncIOThreadHolder::VsyncIOThreadHolder() |
15 | 0 | { |
16 | 0 | MOZ_COUNT_CTOR(VsyncIOThreadHolder); |
17 | 0 | } |
18 | | |
19 | | VsyncIOThreadHolder::~VsyncIOThreadHolder() |
20 | 0 | { |
21 | 0 | MOZ_COUNT_DTOR(VsyncIOThreadHolder); |
22 | 0 |
|
23 | 0 | if (!mThread) { |
24 | 0 | return; |
25 | 0 | } |
26 | 0 | |
27 | 0 | if (NS_IsMainThread()) { |
28 | 0 | mThread->AsyncShutdown(); |
29 | 0 | } else { |
30 | 0 | SystemGroup::Dispatch(TaskCategory::Other, NewRunnableMethod( |
31 | 0 | "nsIThread::AsyncShutdown", mThread, &nsIThread::AsyncShutdown)); |
32 | 0 | } |
33 | 0 | } |
34 | | |
35 | | bool |
36 | | VsyncIOThreadHolder::Start() |
37 | 0 | { |
38 | 0 | nsresult rv = NS_NewNamedThread("VsyncIOThread", getter_AddRefs(mThread)); |
39 | 0 | return NS_SUCCEEDED(rv); |
40 | 0 | } |
41 | | |
42 | | RefPtr<nsIThread> |
43 | | VsyncIOThreadHolder::GetThread() const |
44 | 0 | { |
45 | 0 | return mThread; |
46 | 0 | } |
47 | | |
48 | | } // namespace gfx |
49 | | } // namespace mozilla |