RequestContextService.h (1219B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 ;*; */ 2 /* vim: set sw=2 ts=8 et 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/. */ 6 7 #ifndef mozilla__net__RequestContextService_h 8 #define mozilla__net__RequestContextService_h 9 10 #include "nsCOMPtr.h" 11 #include "nsInterfaceHashtable.h" 12 #include "nsIObserver.h" 13 #include "nsIRequestContext.h" 14 15 namespace mozilla { 16 namespace net { 17 18 class RequestContextService final : public nsIRequestContextService, 19 public nsIObserver { 20 public: 21 NS_DECL_ISUPPORTS 22 NS_DECL_NSIREQUESTCONTEXTSERVICE 23 NS_DECL_NSIOBSERVER 24 25 static already_AddRefed<nsIRequestContextService> GetOrCreate(); 26 27 private: 28 RequestContextService(); 29 virtual ~RequestContextService(); 30 31 nsresult Init(); 32 void Shutdown(); 33 34 static RequestContextService* sSelf; 35 36 nsInterfaceHashtable<nsUint64HashKey, nsIRequestContext> mTable; 37 uint32_t mRCIDNamespace{0}; 38 uint32_t mNextRCID{1}; 39 }; 40 41 } // namespace net 42 } // namespace mozilla 43 44 #endif // mozilla__net__RequestContextService_h