// components/persistent_cache/mojom/persistent_cache.mojom-send-validation.h is auto generated by mojom_bindings_generator.py, do not edit

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

#ifndef COMPONENTS_PERSISTENT_CACHE_MOJOM_PERSISTENT_CACHE_MOJOM_SEND_VALIDATION_H_
#define COMPONENTS_PERSISTENT_CACHE_MOJOM_PERSISTENT_CACHE_MOJOM_SEND_VALIDATION_H_

#include "components/persistent_cache/mojom/persistent_cache.mojom-shared-internal.h"
#include "components/sqlite_vfs/mojom/sqlite_vfs.mojom-shared.h"

#include "components/persistent_cache/mojom/persistent_cache.mojom-data-view.h"

#include "mojo/public/cpp/bindings/lib/send_validation_type.h"
#include "mojo/public/cpp/bindings/lib/send_validation.h"

namespace mojo::internal {

template <typename MaybeConstUserType, mojo::internal::SendValidation send_validation>
struct SendValidationSerializer<::persistent_cache::mojom::PendingReadOnlyBackendDataView, MaybeConstUserType, send_validation> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = StructTraits<::persistent_cache::mojom::PendingReadOnlyBackendDataView, UserType>;
  static void Serialize(
      MaybeConstUserType& input,
      mojo::internal::MessageFragment<::persistent_cache::mojom::internal::PendingReadOnlyBackend_Data>& fragment) {
    if (CallIsNullIfExists<Traits>(input))
      return;
    fragment.Allocate();

      decltype(Traits::pending_file_set(input)) in_pending_file_set = Traits::pending_file_set(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->pending_file_set)::BaseType> pending_file_set_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::sqlite_vfs::mojom::PendingReadOnlyFileSetDataView, send_validation>(
        in_pending_file_set,
        pending_file_set_fragment);

      fragment->pending_file_set.Set(
          pending_file_set_fragment.is_null() ? nullptr : pending_file_set_fragment.data());

      
      MOJO_INTERNAL_CHECK_SERIALIZATION(
        send_validation,
        !(fragment->pending_file_set.is_null()),
        mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
        "null pending_file_set in PendingReadOnlyBackend struct");
  }
};

template <typename MaybeConstUserType, mojo::internal::SendValidation send_validation>
struct SendValidationSerializer<::persistent_cache::mojom::PendingReadWriteBackendDataView, MaybeConstUserType, send_validation> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = StructTraits<::persistent_cache::mojom::PendingReadWriteBackendDataView, UserType>;
  static void Serialize(
      MaybeConstUserType& input,
      mojo::internal::MessageFragment<::persistent_cache::mojom::internal::PendingReadWriteBackend_Data>& fragment) {
    if (CallIsNullIfExists<Traits>(input))
      return;
    fragment.Allocate();

      decltype(Traits::pending_file_set(input)) in_pending_file_set = Traits::pending_file_set(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->pending_file_set)::BaseType> pending_file_set_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::sqlite_vfs::mojom::PendingReadWriteFileSetDataView, send_validation>(
        in_pending_file_set,
        pending_file_set_fragment);

      fragment->pending_file_set.Set(
          pending_file_set_fragment.is_null() ? nullptr : pending_file_set_fragment.data());

      
      MOJO_INTERNAL_CHECK_SERIALIZATION(
        send_validation,
        !(fragment->pending_file_set.is_null()),
        mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
        "null pending_file_set in PendingReadWriteBackend struct");
  }
};

}  // namespace mojo::internal

#endif  // COMPONENTS_PERSISTENT_CACHE_MOJOM_PERSISTENT_CACHE_MOJOM_SEND_VALIDATION_H_