mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-04-19 02:10:26 +00:00
This will allow sharing e.g. document cookie versions between the UI and WebContent processes, and safely accessing those versions. Core::AnonymousBuffer internally creates a minimum buffer of PAGE_SIZE bytes. This is much more than the size of a single version, but this affords us the opportunity to share multiple versions in a single buffer between processes. With a PAGE_SIZE of 4096, we can share up to 512 versions in a single buffer.
26 lines
712 B
C++
26 lines
712 B
C++
/*
|
|
* Copyright (c) 2026, Tim Flynn <trflynn89@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Optional.h>
|
|
#include <AK/Types.h>
|
|
#include <LibCore/AnonymousBuffer.h>
|
|
|
|
namespace Core {
|
|
|
|
using SharedVersion = u64;
|
|
using SharedVersionIndex = u32;
|
|
|
|
constexpr inline SharedVersion INVALID_SHARED_VERSION = 0;
|
|
constexpr inline SharedVersion INITIAL_SHARED_VERSION = 1;
|
|
|
|
[[nodiscard]] AnonymousBuffer create_shared_version_buffer();
|
|
[[nodiscard]] bool initialize_shared_version(AnonymousBuffer&, SharedVersionIndex);
|
|
void increment_shared_version(AnonymousBuffer&, SharedVersionIndex);
|
|
Optional<SharedVersion> get_shared_version(AnonymousBuffer const&, SharedVersionIndex);
|
|
|
|
}
|