// chrome/common/media/webrtc_logging.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 "chrome/common/media/webrtc_logging.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 "chrome/common/media/webrtc_logging.mojom-params-data.h"
namespace chrome {
namespace mojom {

namespace internal {


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

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

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

  return true;
}

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


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

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

  return true;
}

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


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

  return true;
}

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


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

  if (!mojo::internal::ValidateHandleOrInterfaceNonNullable(
          object->client, 1, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateHandleOrInterface(object->client,
                                                 validation_context)) {
    return false;
  }

  return true;
}

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


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

  return true;
}

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

}  // namespace internal
}  // namespace mojom
}  // namespace chrome