QueueObject.h 821 B

12345678910111213141516171819202122232425262728293031323334
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* vim:set ts=2 sw=2 sts=2 et cindent: */
  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. #ifndef MOZILLA_QUEUE_OBJECT_H
  7. #define MOZILLA_QUEUE_OBJECT_H
  8. #include "mozilla/RefPtr.h"
  9. #include "nsIRunnable.h"
  10. #include "nsThreadUtils.h"
  11. namespace mozilla {
  12. class AbstractThread;
  13. class QueueObject
  14. {
  15. public:
  16. explicit QueueObject(RefPtr<AbstractThread> aThread);
  17. ~QueueObject();
  18. void Dispatch(nsIRunnable* aRunnable);
  19. void Dispatch(already_AddRefed<nsIRunnable> aRunnable);
  20. bool OnThread();
  21. AbstractThread* Thread();
  22. private:
  23. RefPtr<AbstractThread> mThread;
  24. };
  25. }
  26. #endif