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 : #ifndef mozilla_dom_cache_CacheWorkerHolder_h
8 : #define mozilla_dom_cache_CacheWorkerHolder_h
9 :
10 : #include "nsISupportsImpl.h"
11 : #include "nsTArray.h"
12 : #include "WorkerHolder.h"
13 :
14 : namespace mozilla {
15 :
16 : namespace workers {
17 : class WorkerPrivate;
18 : } // namespace workers
19 :
20 : namespace dom {
21 : namespace cache {
22 :
23 : class ActorChild;
24 :
25 : class CacheWorkerHolder final : public workers::WorkerHolder
26 : {
27 : public:
28 : static already_AddRefed<CacheWorkerHolder>
29 : Create(workers::WorkerPrivate* aWorkerPrivate,
30 : Behavior aBehavior);
31 :
32 : static already_AddRefed<CacheWorkerHolder>
33 : PreferBehavior(CacheWorkerHolder* aCurrentHolder, Behavior aBehavior);
34 :
35 : void AddActor(ActorChild* aActor);
36 : void RemoveActor(ActorChild* aActor);
37 :
38 : bool Notified() const;
39 :
40 : // WorkerHolder methods
41 : virtual bool Notify(workers::Status aStatus) override;
42 :
43 : private:
44 : explicit CacheWorkerHolder(Behavior aBehavior);
45 : ~CacheWorkerHolder();
46 :
47 : nsTArray<ActorChild*> mActorList;
48 : bool mNotified;
49 :
50 : public:
51 0 : NS_INLINE_DECL_REFCOUNTING(mozilla::dom::cache::CacheWorkerHolder)
52 : };
53 :
54 : } // namespace cache
55 : } // namespace dom
56 : } // namespace mozilla
57 :
58 : #endif // mozilla_dom_cache_CacheWorkerHolder_h
|