2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-11-24 01:56:06 +03:00
|
|
|
|
|
|
|
#ifndef RedirectChannelRegistrar_h__
|
|
|
|
#define RedirectChannelRegistrar_h__
|
|
|
|
|
|
|
|
#include "nsIRedirectChannelRegistrar.h"
|
|
|
|
|
|
|
|
#include "nsIChannel.h"
|
|
|
|
#include "nsIParentChannel.h"
|
2013-09-02 12:41:57 +04:00
|
|
|
#include "nsInterfaceHashtable.h"
|
2012-06-06 07:18:25 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2016-01-09 04:20:50 +03:00
|
|
|
#include "mozilla/Mutex.h"
|
2010-11-24 01:56:06 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class RedirectChannelRegistrar final : public nsIRedirectChannelRegistrar {
|
2010-11-24 01:56:06 +03:00
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIREDIRECTCHANNELREGISTRAR
|
|
|
|
|
|
|
|
RedirectChannelRegistrar();
|
|
|
|
|
2014-06-24 20:36:44 +04:00
|
|
|
private:
|
2018-04-30 19:46:04 +03:00
|
|
|
~RedirectChannelRegistrar() = default;
|
2014-06-24 20:36:44 +04:00
|
|
|
|
2018-08-22 07:37:28 +03:00
|
|
|
public:
|
|
|
|
// Singleton accessor
|
|
|
|
static already_AddRefed<nsIRedirectChannelRegistrar> GetOrCreate();
|
|
|
|
|
|
|
|
// Cleanup the singleton instance on shutdown
|
|
|
|
static void Shutdown();
|
|
|
|
|
2010-11-24 01:56:06 +03:00
|
|
|
protected:
|
2013-09-02 12:41:57 +04:00
|
|
|
typedef nsInterfaceHashtable<nsUint32HashKey, nsIChannel> ChannelHashtable;
|
|
|
|
typedef nsInterfaceHashtable<nsUint32HashKey, nsIParentChannel>
|
2010-11-24 01:56:06 +03:00
|
|
|
ParentChannelHashtable;
|
|
|
|
|
|
|
|
ChannelHashtable mRealChannels;
|
|
|
|
ParentChannelHashtable mParentChannels;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mId;
|
2015-12-04 11:55:00 +03:00
|
|
|
Mutex mLock;
|
2018-10-29 14:22:58 +03:00
|
|
|
|
|
|
|
static StaticRefPtr<RedirectChannelRegistrar> gSingleton;
|
2010-11-24 01:56:06 +03:00
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|
2010-11-24 01:56:06 +03:00
|
|
|
|
|
|
|
#endif
|