Bug 1609862 - Display more detailed memory info in resource usage report. r=froydnj
[gecko.git] / xpcom / ds / nsArray.h
blob94c0f8155745ad1976e7be4820182ed57242b5de
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/. */
7 #ifndef nsArray_h__
8 #define nsArray_h__
10 #include "nsIMutableArray.h"
11 #include "nsCOMArray.h"
12 #include "nsCOMPtr.h"
13 #include "nsCycleCollectionParticipant.h"
14 #include "mozilla/Attributes.h"
16 // {35C66FD1-95E9-4e0a-80C5-C3BD2B375481}
17 #define NS_ARRAY_CID \
18 { \
19 0x35c66fd1, 0x95e9, 0x4e0a, { \
20 0x80, 0xc5, 0xc3, 0xbd, 0x2b, 0x37, 0x54, 0x81 \
21 } \
24 // nsArray without any refcounting declarations
25 class nsArrayBase : public nsIMutableArray {
26 public:
27 NS_DECL_NSIARRAY
28 NS_DECL_NSIARRAYEXTENSIONS
29 NS_DECL_NSIMUTABLEARRAY
31 /* Both of these factory functions create a cycle-collectable array
32 on the main thread and a non-cycle-collectable array on other
33 threads. */
34 static already_AddRefed<nsIMutableArray> Create();
35 /* Only for the benefit of the XPCOM module system, use Create()
36 instead. */
37 static nsresult XPCOMConstructor(nsISupports* aOuter, const nsIID& aIID,
38 void** aResult);
40 protected:
41 nsArrayBase() {}
42 nsArrayBase(const nsArrayBase& aOther);
43 explicit nsArrayBase(const nsCOMArray_base& aBaseArray)
44 : mArray(aBaseArray) {}
45 virtual ~nsArrayBase();
47 nsCOMArray_base mArray;
50 class nsArray final : public nsArrayBase {
51 friend class nsArrayBase;
53 public:
54 NS_DECL_ISUPPORTS
56 private:
57 nsArray() : nsArrayBase() {}
58 nsArray(const nsArray& aOther);
59 explicit nsArray(const nsCOMArray_base& aBaseArray)
60 : nsArrayBase(aBaseArray) {}
61 ~nsArray() {}
64 class nsArrayCC final : public nsArrayBase {
65 friend class nsArrayBase;
67 public:
68 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
69 NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsArrayCC, nsIMutableArray)
71 private:
72 nsArrayCC() : nsArrayBase() {}
73 nsArrayCC(const nsArrayCC& aOther);
74 explicit nsArrayCC(const nsCOMArray_base& aBaseArray)
75 : nsArrayBase(aBaseArray) {}
76 ~nsArrayCC() {}
79 #endif