Ril.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_ipc_Ril_h
  6. #define mozilla_ipc_Ril_h 1
  7. #include "nsError.h"
  8. #include "nsTArray.h"
  9. namespace mozilla {
  10. namespace dom {
  11. namespace workers {
  12. class WorkerCrossThreadDispatcher;
  13. } // namespace workers
  14. } // namespace dom
  15. namespace ipc {
  16. class RilConsumer;
  17. class RilWorker final
  18. {
  19. public:
  20. static nsresult Register(
  21. unsigned int aClientId,
  22. mozilla::dom::workers::WorkerCrossThreadDispatcher* aDispatcher);
  23. static void Shutdown();
  24. // Public for |MakeUnique| Call |Register| instead.
  25. RilWorker(mozilla::dom::workers::WorkerCrossThreadDispatcher* aDispatcher);
  26. private:
  27. class RegisterConsumerTask;
  28. class UnregisterConsumerTask;
  29. nsresult RegisterConsumer(unsigned int aClientId);
  30. void UnregisterConsumer(unsigned int aClientId);
  31. static nsTArray<UniquePtr<RilWorker>> sRilWorkers;
  32. RefPtr<mozilla::dom::workers::WorkerCrossThreadDispatcher> mDispatcher;
  33. };
  34. } // namespace ipc
  35. } // namespace mozilla
  36. #endif // mozilla_ipc_Ril_h