michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsArray_h__ michael@0: #define nsArray_h__ michael@0: michael@0: #include "nsIMutableArray.h" michael@0: #include "nsCOMArray.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsCycleCollectionParticipant.h" michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: // {35C66FD1-95E9-4e0a-80C5-C3BD2B375481} michael@0: #define NS_ARRAY_CID \ michael@0: { 0x35c66fd1, 0x95e9, 0x4e0a, \ michael@0: { 0x80, 0xc5, 0xc3, 0xbd, 0x2b, 0x37, 0x54, 0x81 } } michael@0: michael@0: class nsArray : public nsIMutableArray michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIARRAY michael@0: NS_DECL_NSIMUTABLEARRAY michael@0: michael@0: /* Both of these factory functions create a cycle-collectable array michael@0: on the main thread and a non-cycle-collectable array on other michael@0: threads. */ michael@0: static already_AddRefed Create(); michael@0: /* Only for the benefit of the XPCOM module system, use Create() michael@0: instead. */ michael@0: static nsresult XPCOMConstructor(nsISupports* aOuter, const nsIID& aIID, michael@0: void** aResult); michael@0: protected: michael@0: nsArray() { } michael@0: nsArray(const nsArray& other); michael@0: nsArray(const nsCOMArray_base& aBaseArray) : mArray(aBaseArray) michael@0: { } michael@0: michael@0: virtual ~nsArray(); // nsArrayCC inherits from this michael@0: michael@0: nsCOMArray_base mArray; michael@0: }; michael@0: michael@0: class nsArrayCC MOZ_FINAL : public nsArray michael@0: { michael@0: friend class nsArray; michael@0: michael@0: public: michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: NS_DECL_CYCLE_COLLECTION_CLASS(nsArrayCC) michael@0: michael@0: private: michael@0: nsArrayCC() : nsArray() { } michael@0: nsArrayCC(const nsArrayCC& other); michael@0: nsArrayCC(const nsCOMArray_base& aBaseArray) : nsArray(aBaseArray) michael@0: { } michael@0: }; michael@0: michael@0: #endif