xpcom/ds/nsArray.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     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/. */
     6 #ifndef nsArray_h__
     7 #define nsArray_h__
     9 #include "nsIMutableArray.h"
    10 #include "nsCOMArray.h"
    11 #include "nsCOMPtr.h"
    12 #include "nsCycleCollectionParticipant.h"
    13 #include "mozilla/Attributes.h"
    15 // {35C66FD1-95E9-4e0a-80C5-C3BD2B375481}
    16 #define NS_ARRAY_CID \
    17 { 0x35c66fd1, 0x95e9, 0x4e0a, \
    18   { 0x80, 0xc5, 0xc3, 0xbd, 0x2b, 0x37, 0x54, 0x81 } }
    20 class nsArray : public nsIMutableArray
    21 {
    22 public:
    23     NS_DECL_ISUPPORTS
    24     NS_DECL_NSIARRAY
    25     NS_DECL_NSIMUTABLEARRAY
    27     /* Both of these factory functions create a cycle-collectable array
    28        on the main thread and a non-cycle-collectable array on other
    29        threads.  */
    30     static already_AddRefed<nsIMutableArray> Create();
    31     /* Only for the benefit of the XPCOM module system, use Create()
    32        instead.  */
    33     static nsresult XPCOMConstructor(nsISupports* aOuter, const nsIID& aIID,
    34                                      void** aResult);
    35 protected:
    36     nsArray() { }
    37     nsArray(const nsArray& other);
    38     nsArray(const nsCOMArray_base& aBaseArray) : mArray(aBaseArray)
    39     { }
    41     virtual ~nsArray(); // nsArrayCC inherits from this
    43     nsCOMArray_base mArray;
    44 };
    46 class nsArrayCC MOZ_FINAL : public nsArray
    47 {
    48     friend class nsArray;
    50 public:
    51     NS_DECL_CYCLE_COLLECTING_ISUPPORTS
    52     NS_DECL_CYCLE_COLLECTION_CLASS(nsArrayCC)
    54 private:
    55     nsArrayCC() : nsArray() { }
    56     nsArrayCC(const nsArrayCC& other);
    57     nsArrayCC(const nsCOMArray_base& aBaseArray) : nsArray(aBaseArray)
    58     { }
    59 };
    61 #endif

mercurial