diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /netwerk/protocol/http/SpeculativeTransaction.h | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | netwerk/protocol/http/SpeculativeTransaction.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/netwerk/protocol/http/SpeculativeTransaction.h b/netwerk/protocol/http/SpeculativeTransaction.h new file mode 100644 index 0000000000..851fe2b39f --- /dev/null +++ b/netwerk/protocol/http/SpeculativeTransaction.h @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* vim:set ts=4 sw=4 sts=4 et cin: */ +/* 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/. */ + +#ifndef SpeculativeTransaction_h__ +#define SpeculativeTransaction_h__ + +#include "mozilla/Maybe.h" +#include "NullHttpTransaction.h" + +namespace mozilla { +namespace net { + +class HTTPSRecordResolver; + +class SpeculativeTransaction : public NullHttpTransaction { + public: + SpeculativeTransaction(nsHttpConnectionInfo* aConnInfo, + nsIInterfaceRequestor* aCallbacks, uint32_t aCaps, + std::function<void(bool)>&& aCallback = nullptr); + + already_AddRefed<SpeculativeTransaction> CreateWithNewConnInfo( + nsHttpConnectionInfo* aConnInfo); + + virtual nsresult FetchHTTPSRR() override; + + virtual nsresult OnHTTPSRRAvailable( + nsIDNSHTTPSSVCRecord* aHTTPSSVCRecord, + nsISVCBRecord* aHighestPriorityRecord) override; + + void SetParallelSpeculativeConnectLimit(uint32_t aLimit) { + mParallelSpeculativeConnectLimit.emplace(aLimit); + } + void SetIgnoreIdle(bool aIgnoreIdle) { mIgnoreIdle.emplace(aIgnoreIdle); } + void SetIsFromPredictor(bool aIsFromPredictor) { + mIsFromPredictor.emplace(aIsFromPredictor); + } + void SetAllow1918(bool aAllow1918) { mAllow1918.emplace(aAllow1918); } + + const Maybe<uint32_t>& ParallelSpeculativeConnectLimit() { + return mParallelSpeculativeConnectLimit; + } + const Maybe<bool>& IgnoreIdle() { return mIgnoreIdle; } + const Maybe<bool>& IsFromPredictor() { return mIsFromPredictor; } + const Maybe<bool>& Allow1918() { return mAllow1918; } + + void Close(nsresult aReason) override; + nsresult ReadSegments(nsAHttpSegmentReader* aReader, uint32_t aCount, + uint32_t* aCountRead) override; + void InvokeCallback(); + + protected: + virtual ~SpeculativeTransaction() = default; + + private: + Maybe<uint32_t> mParallelSpeculativeConnectLimit; + Maybe<bool> mIgnoreIdle; + Maybe<bool> mIsFromPredictor; + Maybe<bool> mAllow1918; + + bool mTriedToWrite = false; + std::function<void(bool)> mCloseCallback; +}; + +} // namespace net +} // namespace mozilla + +#endif // SpeculativeTransaction_h__ |