netwerk/base/src/nsSimpleURI.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef nsSimpleURI_h__
michael@0 7 #define nsSimpleURI_h__
michael@0 8
michael@0 9 #include "mozilla/MemoryReporting.h"
michael@0 10 #include "nsIURI.h"
michael@0 11 #include "nsISerializable.h"
michael@0 12 #include "nsString.h"
michael@0 13 #include "nsIClassInfo.h"
michael@0 14 #include "nsIMutable.h"
michael@0 15 #include "nsISizeOf.h"
michael@0 16 #include "nsIIPCSerializableURI.h"
michael@0 17
michael@0 18 #define NS_THIS_SIMPLEURI_IMPLEMENTATION_CID \
michael@0 19 { /* 0b9bb0c2-fee6-470b-b9b9-9fd9462b5e19 */ \
michael@0 20 0x0b9bb0c2, \
michael@0 21 0xfee6, \
michael@0 22 0x470b, \
michael@0 23 {0xb9, 0xb9, 0x9f, 0xd9, 0x46, 0x2b, 0x5e, 0x19} \
michael@0 24 }
michael@0 25
michael@0 26 class nsSimpleURI : public nsIURI,
michael@0 27 public nsISerializable,
michael@0 28 public nsIClassInfo,
michael@0 29 public nsIMutable,
michael@0 30 public nsISizeOf,
michael@0 31 public nsIIPCSerializableURI
michael@0 32 {
michael@0 33 public:
michael@0 34 NS_DECL_ISUPPORTS
michael@0 35 NS_DECL_NSIURI
michael@0 36 NS_DECL_NSISERIALIZABLE
michael@0 37 NS_DECL_NSICLASSINFO
michael@0 38 NS_DECL_NSIMUTABLE
michael@0 39 NS_DECL_NSIIPCSERIALIZABLEURI
michael@0 40
michael@0 41 // nsSimpleURI methods:
michael@0 42
michael@0 43 nsSimpleURI();
michael@0 44 virtual ~nsSimpleURI();
michael@0 45
michael@0 46 // nsISizeOf
michael@0 47 // Among the sub-classes that inherit (directly or indirectly) from
michael@0 48 // nsSimpleURI, measurement of the following members may be added later if
michael@0 49 // DMD finds it is worthwhile:
michael@0 50 // - nsJSURI: mBaseURI
michael@0 51 // - nsSimpleNestedURI: mInnerURI
michael@0 52 // - nsBlobURI: mPrincipal
michael@0 53 virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
michael@0 54 virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
michael@0 55
michael@0 56 protected:
michael@0 57 // enum used in a few places to specify how .ref attribute should be handled
michael@0 58 enum RefHandlingEnum {
michael@0 59 eIgnoreRef,
michael@0 60 eHonorRef
michael@0 61 };
michael@0 62
michael@0 63 // Helper to share code between Equals methods.
michael@0 64 virtual nsresult EqualsInternal(nsIURI* other,
michael@0 65 RefHandlingEnum refHandlingMode,
michael@0 66 bool* result);
michael@0 67
michael@0 68 // Helper to be used by inherited classes who want to test
michael@0 69 // equality given an assumed nsSimpleURI. This must NOT check
michael@0 70 // the passed-in other for QI to our CID.
michael@0 71 bool EqualsInternal(nsSimpleURI* otherUri, RefHandlingEnum refHandlingMode);
michael@0 72
michael@0 73 // NOTE: This takes the refHandlingMode as an argument because
michael@0 74 // nsSimpleNestedURI's specialized version needs to know how to clone
michael@0 75 // its inner URI.
michael@0 76 virtual nsSimpleURI* StartClone(RefHandlingEnum refHandlingMode);
michael@0 77
michael@0 78 // Helper to share code between Clone methods.
michael@0 79 virtual nsresult CloneInternal(RefHandlingEnum refHandlingMode,
michael@0 80 nsIURI** clone);
michael@0 81
michael@0 82 nsCString mScheme;
michael@0 83 nsCString mPath; // NOTE: mPath does not include ref, as an optimization
michael@0 84 nsCString mRef; // so that URIs with different refs can share string data.
michael@0 85 bool mMutable;
michael@0 86 bool mIsRefValid; // To distinguish between empty-ref and no-ref.
michael@0 87 };
michael@0 88
michael@0 89 #endif // nsSimpleURI_h__

mercurial