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 nsHashPropertyBag_h___
8 : #define nsHashPropertyBag_h___
9 :
10 : #include "nsIVariant.h"
11 : #include "nsIWritablePropertyBag.h"
12 : #include "nsIWritablePropertyBag2.h"
13 :
14 : #include "nsCycleCollectionParticipant.h"
15 : #include "nsInterfaceHashtable.h"
16 :
17 1156 : class nsHashPropertyBagBase
18 : : public nsIWritablePropertyBag
19 : , public nsIWritablePropertyBag2
20 : {
21 : public:
22 1194 : nsHashPropertyBagBase() {}
23 :
24 : NS_DECL_NSIPROPERTYBAG
25 : NS_DECL_NSIPROPERTYBAG2
26 :
27 : NS_DECL_NSIWRITABLEPROPERTYBAG
28 : NS_DECL_NSIWRITABLEPROPERTYBAG2
29 :
30 : protected:
31 : // a hash table of string -> nsIVariant
32 : nsInterfaceHashtable<nsStringHashKey, nsIVariant> mPropertyHash;
33 : };
34 :
35 : class nsHashPropertyBag : public nsHashPropertyBagBase
36 : {
37 : public:
38 1194 : nsHashPropertyBag() {}
39 : NS_DECL_THREADSAFE_ISUPPORTS
40 :
41 : protected:
42 : virtual ~nsHashPropertyBag();
43 : };
44 :
45 : /* A cycle collected nsHashPropertyBag for main-thread-only use. */
46 : class nsHashPropertyBagCC final : public nsHashPropertyBagBase
47 : {
48 : public:
49 0 : nsHashPropertyBagCC() {}
50 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
51 0 : NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsHashPropertyBagCC,
52 : nsIWritablePropertyBag)
53 : protected:
54 0 : virtual ~nsHashPropertyBagCC() {}
55 : };
56 :
57 : #endif /* nsHashPropertyBag_h___ */
|