CacheWorkerHolder.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  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_dom_cache_CacheWorkerHolder_h
  6. #define mozilla_dom_cache_CacheWorkerHolder_h
  7. #include "nsISupportsImpl.h"
  8. #include "nsTArray.h"
  9. #include "WorkerHolder.h"
  10. namespace mozilla {
  11. namespace workers {
  12. class WorkerPrivate;
  13. } // namespace workers
  14. namespace dom {
  15. namespace cache {
  16. class ActorChild;
  17. class CacheWorkerHolder final : public workers::WorkerHolder
  18. {
  19. public:
  20. static already_AddRefed<CacheWorkerHolder>
  21. Create(workers::WorkerPrivate* aWorkerPrivate);
  22. void AddActor(ActorChild* aActor);
  23. void RemoveActor(ActorChild* aActor);
  24. bool Notified() const;
  25. // WorkerHolder methods
  26. virtual bool Notify(workers::Status aStatus) override;
  27. private:
  28. CacheWorkerHolder();
  29. ~CacheWorkerHolder();
  30. nsTArray<ActorChild*> mActorList;
  31. bool mNotified;
  32. public:
  33. NS_INLINE_DECL_REFCOUNTING(mozilla::dom::cache::CacheWorkerHolder)
  34. };
  35. } // namespace cache
  36. } // namespace dom
  37. } // namespace mozilla
  38. #endif // mozilla_dom_cache_CacheWorkerHolder_h