ladybird/Userland/Libraries/LibWeb/Fetch/Fetching/RefCountedFlag.h
Linus Groh c8d121fa32 LibWeb: Implement most of the 'Fetching' AOs
This implements the following operations from section 4 of the Fetch
spec (https://fetch.spec.whatwg.org/#fetching):

- Fetch
- Main fetch
- Fetch response handover
- Scheme fetch
- HTTP fetch
- HTTP-redirect fetch
- HTTP-network-or-cache fetch (without caching)

It does *not* implement:

- HTTP-network fetch
- CORS-preflight fetch

Instead, we let ResourceLoader handle the actual networking for now,
which isn't ideal, but certainly enough to get enough functionality up
and running for most websites to not complain.
2022-10-30 20:10:29 +00:00

29 lines
598 B
C++

/*
* Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/RefCounted.h>
namespace Web::Fetch::Fetching {
/// A ref-counted boolean flag.
/// This is used to share flags between multiple callback closures.
class RefCountedFlag : public RefCounted<RefCountedFlag> {
public:
static NonnullRefPtr<RefCountedFlag> create(bool);
[[nodiscard]] bool value() const { return m_value; }
void set_value(bool value) { m_value = value; }
private:
explicit RefCountedFlag(bool);
bool m_value { false };
};
}