From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- netwerk/protocol/http/SpeculativeTransaction.h | 70 ++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 netwerk/protocol/http/SpeculativeTransaction.h (limited to 'netwerk/protocol/http/SpeculativeTransaction.h') 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&& aCallback = nullptr); + + already_AddRefed 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& ParallelSpeculativeConnectLimit() { + return mParallelSpeculativeConnectLimit; + } + const Maybe& IgnoreIdle() { return mIgnoreIdle; } + const Maybe& IsFromPredictor() { return mIsFromPredictor; } + const Maybe& 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 mParallelSpeculativeConnectLimit; + Maybe mIgnoreIdle; + Maybe mIsFromPredictor; + Maybe mAllow1918; + + bool mTriedToWrite = false; + std::function mCloseCallback; +}; + +} // namespace net +} // namespace mozilla + +#endif // SpeculativeTransaction_h__ -- cgit v1.2.3