// ipc/ipc.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 "ipc/ipc.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 "ipc/ipc.mojom-params-data.h"
namespace IPC {
namespace mojom {

namespace internal {


// static
bool Message_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 24, 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 Message_Data* object =
      static_cast<const Message_Data*>(data);

  if (!mojo::internal::ValidatePointerNonNullable(
          object->bytes, 1, validation_context)) {
    return false;
  }
  constexpr const mojo::internal::ContainerValidateParams& bytes_validate_params =
      mojo::internal::GetArrayValidator<0, false, nullptr>();
  if (!mojo::internal::ValidateContainer(object->bytes, validation_context,
                                         &bytes_validate_params)) {
    return false;
  }

  constexpr const mojo::internal::ContainerValidateParams& handles_validate_params =
      mojo::internal::GetArrayValidator<0, false, nullptr>();
  if (!mojo::internal::ValidateContainer(object->handles, validation_context,
                                         &handles_validate_params)) {
    return false;
  }

  return true;
}

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


// static
bool Channel_SetPeerPid_Params_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 16, 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 Channel_SetPeerPid_Params_Data* object =
      static_cast<const Channel_SetPeerPid_Params_Data*>(data);

  return true;
}

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


// static
bool Channel_GetAssociatedInterface_Params_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 16, 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 Channel_GetAssociatedInterface_Params_Data* object =
      static_cast<const Channel_GetAssociatedInterface_Params_Data*>(data);

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

  return true;
}

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

}  // namespace internal
}  // namespace mojom
}  // namespace IPC