// components/sqlite_vfs/mojom/sqlite_vfs.mojom-shared.cc is auto generated by mojom_bindings_generator.py, do not edit

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

#include "components/sqlite_vfs/mojom/sqlite_vfs.mojom-shared.h"
#include <utility>
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/lib/validation_util.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"

#include "components/sqlite_vfs/mojom/sqlite_vfs.mojom-params-data.h"
namespace sqlite_vfs {
namespace mojom {

namespace internal {


// static
bool PendingReadOnlyFileSet_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 56, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const PendingReadOnlyFileSet_Data* object =
      static_cast<const PendingReadOnlyFileSet_Data*>(data);

  if (!mojo::internal::ValidatePointerNonNullable(
          object->db_file, 1, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateStruct(object->db_file, validation_context))
    return false;

  if (!mojo::internal::ValidateStruct(object->journal_file, validation_context))
    return false;

  if (!mojo::internal::ValidateStruct(object->wal_file, validation_context))
    return false;

  if (!mojo::internal::ValidateStruct(object->wal_index_file, validation_context))
    return false;

  if (!mojo::internal::ValidatePointerNonNullable(
          object->shared_lock, 5, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateStruct(object->shared_lock, validation_context))
    return false;

  return true;
}

PendingReadOnlyFileSet_Data::PendingReadOnlyFileSet_Data()
    : header_({sizeof(*this), 0}) {}


// static
bool PendingReadWriteFileSet_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 64, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const PendingReadWriteFileSet_Data* object =
      static_cast<const PendingReadWriteFileSet_Data*>(data);

  if (!mojo::internal::ValidatePointerNonNullable(
          object->db_file, 1, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateStruct(object->db_file, validation_context))
    return false;

  if (!mojo::internal::ValidateStruct(object->journal_file, validation_context))
    return false;

  if (!mojo::internal::ValidateStruct(object->wal_file, validation_context))
    return false;

  if (!mojo::internal::ValidateStruct(object->wal_index_file, validation_context))
    return false;

  if (!mojo::internal::ValidateStruct(object->wal_index_file_read_only, validation_context))
    return false;

  if (!mojo::internal::ValidateStruct(object->shared_lock, validation_context))
    return false;

  return true;
}

PendingReadWriteFileSet_Data::PendingReadWriteFileSet_Data()
    : header_({sizeof(*this), 0}) {}

}  // namespace internal
}  // namespace mojom
}  // namespace sqlite_vfs