chromium/services/network/pending_callback_chain.h

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef SERVICES_NETWORK_PENDING_CALLBACK_CHAIN_H_
#define SERVICES_NETWORK_PENDING_CALLBACK_CHAIN_H_

#include "base/component_export.h"
#include "base/memory/ref_counted.h"
#include "net/base/completion_once_callback.h"
#include "net/base/net_errors.h"

namespace network {

// Helper class to keep track of multiple functions which may return
// net::ERR_IO_PENDING and call a net::CompletionOnceCallback, or return another
// net error synchronously, and not call the completion callback. If there are
// one or more pending results added, the original completion callback will not
// be called until all those results have completed. If there are multiple error
// results that are different, net::ERR_FAILED will be used.
class COMPONENT_EXPORT(NETWORK_SERVICE) PendingCallbackChain
    : public base::RefCounted<PendingCallbackChain> {};

}  // namespace network

#endif  // SERVICES_NETWORK_PENDING_CALLBACK_CHAIN_H_