Line data Source code
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 "QueueObject.h"
8 : #include "mozilla/AbstractThread.h"
9 : #include "mozilla/TaskQueue.h"
10 : #include "nsThreadUtils.h"
11 :
12 : namespace mozilla {
13 :
14 0 : QueueObject::QueueObject(RefPtr<AbstractThread> aThread) : mThread(aThread) {}
15 :
16 0 : QueueObject::~QueueObject() {}
17 :
18 : void
19 0 : QueueObject::Dispatch(nsIRunnable* aRunnable)
20 : {
21 0 : Dispatch(do_AddRef(aRunnable));
22 0 : }
23 :
24 : void
25 0 : QueueObject::Dispatch(already_AddRefed<nsIRunnable> aRunnable)
26 : {
27 0 : mThread->Dispatch(Move(aRunnable));
28 0 : }
29 :
30 : bool
31 0 : QueueObject::OnThread()
32 : {
33 0 : return mThread->IsCurrentThreadIn();
34 : }
35 :
36 : AbstractThread*
37 0 : QueueObject::Thread()
38 : {
39 0 : return mThread;
40 : }
41 : }
|