Merge mozilla-central to autoland. CLOSED TREE
[gecko.git] / netwerk / base / DefaultURI.h
blobe737067565683437033d070cf85a7461f1d76607
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef DefaultURI_h__
6 #define DefaultURI_h__
8 #include "nsIURI.h"
9 #include "nsISerializable.h"
10 #include "nsISizeOf.h"
11 #include "nsIURIMutator.h"
12 #include "mozilla/net/MozURL.h"
14 namespace mozilla {
15 namespace net {
17 class DefaultURI : public nsIURI, public nsISerializable, public nsISizeOf {
18 public:
19 NS_DECL_THREADSAFE_ISUPPORTS
20 NS_DECL_NSIURI
21 NS_DECL_NSISERIALIZABLE
23 virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
24 virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override;
26 class Mutator final : public nsIURIMutator, public nsISerializable {
27 NS_DECL_ISUPPORTS
28 NS_DECL_NSIURISETSPEC
29 NS_DECL_NSIURISETTERS
30 NS_DECL_NSIURIMUTATOR
32 NS_IMETHOD
33 Write(nsIObjectOutputStream* aOutputStream) override {
34 MOZ_ASSERT_UNREACHABLE("nsIURIMutator.write() should never be called");
35 return NS_ERROR_NOT_IMPLEMENTED;
38 [[nodiscard]] NS_IMETHOD Read(nsIObjectInputStream* aStream) override;
40 explicit Mutator() = default;
42 private:
43 virtual ~Mutator() = default;
44 void Init(DefaultURI* aFrom) { mMutator = Some(aFrom->mURL->Mutate()); }
46 Maybe<MozURL::Mutator> mMutator;
48 friend class DefaultURI;
51 private:
52 virtual ~DefaultURI() = default;
53 RefPtr<MozURL> mURL;
56 } // namespace net
57 } // namespace mozilla
59 #endif // DefaultURI_h__