/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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/. */
using InputStreamOrReason = Result<nsCOMPtr<nsIInputStream>, nsresult>; using NotNullRequest = NotNull<nsCOMPtr<nsIRequest>>; using NotNullCancelable = NotNull<nsCOMPtr<nsICancelable>>; using RequestOrCancelable = Variant<NotNullRequest, NotNullCancelable>; using RequestOrReason = Result<RequestOrCancelable, nsresult>;
class SimpleChannelChild final : public SimpleChannel, public nsIChildChannel, public PSimpleChannelChild { public: explicit SimpleChannelChild(UniquePtr<SimpleChannelCallbacks>&& aCallbacks);
/** * Creates a simple channel which wraps an input stream created by the given * callbacks. The callbacks are not called until the underlying AsyncOpen or * Open methods are called, and correspond to the nsBaseChannel::StartAsyncRead * and nsBaseChannel::OpenContentStream methods of the same names. * * The last two arguments of each callback are the created channel instance, * and the ref-counted context object passed to NS_NewSimpleChannel. A strong * reference to that object is guaranteed to be kept alive until after a * callback successfully completes.
*/ template <typename T, typename F1, typename F2> inline already_AddRefed<nsIChannel> NS_NewSimpleChannel(
nsIURI* aURI, nsILoadInfo* aLoadInfo, T* context, F1&& aStartAsyncRead,
F2&& aOpenContentStream) { usingnamespace mozilla;
auto callbacks = MakeUnique<net::SimpleChannelCallbacksImpl<F1, F2, T>>(
std::forward<F1>(aStartAsyncRead), std::forward<F2>(aOpenContentStream),
context);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.