// ui/gfx/geometry/mojom/geometry.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 "ui/gfx/geometry/mojom/geometry.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 "ui/gfx/geometry/mojom/geometry.mojom-params-data.h"
namespace gfx {
namespace mojom {

namespace internal {


// static
bool Point_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 Point_Data* object =
      static_cast<const Point_Data*>(data);

  return true;
}

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


// static
bool PointF_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 PointF_Data* object =
      static_cast<const PointF_Data*>(data);

  return true;
}

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


// static
bool Point3F_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 Point3F_Data* object =
      static_cast<const Point3F_Data*>(data);

  return true;
}

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


// static
bool Size_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 Size_Data* object =
      static_cast<const Size_Data*>(data);

  return true;
}

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


// static
bool SizeF_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 SizeF_Data* object =
      static_cast<const SizeF_Data*>(data);

  return true;
}

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


// static
bool Rect_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 Rect_Data* object =
      static_cast<const Rect_Data*>(data);

  return true;
}

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


// static
bool RectF_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 RectF_Data* object =
      static_cast<const RectF_Data*>(data);

  return true;
}

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


// static
bool Insets_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 Insets_Data* object =
      static_cast<const Insets_Data*>(data);

  return true;
}

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


// static
bool InsetsF_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 InsetsF_Data* object =
      static_cast<const InsetsF_Data*>(data);

  return true;
}

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


// static
bool Vector2d_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 Vector2d_Data* object =
      static_cast<const Vector2d_Data*>(data);

  return true;
}

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


// static
bool Vector2dF_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 Vector2dF_Data* object =
      static_cast<const Vector2dF_Data*>(data);

  return true;
}

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


// static
bool Vector3dF_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 Vector3dF_Data* object =
      static_cast<const Vector3dF_Data*>(data);

  return true;
}

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


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

  return true;
}

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


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

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

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

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

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

  return true;
}

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


// static
bool AxisTransform2d_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 AxisTransform2d_Data* object =
      static_cast<const AxisTransform2d_Data*>(data);

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

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

  return true;
}

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

}  // namespace internal
}  // namespace mojom
}  // namespace gfx