// services/tracing/public/mojom/tracing_service.mojom-data-view.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.

// This file defines XDataView for type traits and can be included in
// _mojom_traits.h definitions but otherwise please use .mojom-forward.h,
// .mojom-shared.h or .mojom.h.

// IWYU pragma: private
// IWYU pragma: friend "traits"

#ifndef SERVICES_TRACING_PUBLIC_MOJOM_TRACING_SERVICE_MOJOM_DATA_VIEW_H_
#define SERVICES_TRACING_PUBLIC_MOJOM_TRACING_SERVICE_MOJOM_DATA_VIEW_H_

#include <stdint.h>

#include <functional>
#include <iosfwd>
#include <type_traits>
#include <utility>
#include "mojo/public/cpp/bindings/array_data_view.h"
#include "mojo/public/cpp/bindings/string_data_view.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"

#include "services/tracing/public/mojom/tracing_service.mojom-shared-internal.h"
#include "sandbox/policy/mojom/context.mojom-shared.h"
#include "sandbox/policy/mojom/sandbox.mojom-shared.h"
#include "services/tracing/public/mojom/traced_process.mojom-shared.h"
#include "services/tracing/public/mojom/perfetto_service.mojom-shared.h"


namespace tracing::mojom {
class ClientInfoDataView;



}  // tracing::mojom


namespace mojo {
namespace internal {

template <>
struct MojomTypeTraits<::tracing::mojom::ClientInfoDataView> {
  using Data = ::tracing::mojom::internal::ClientInfo_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

}  // namespace internal
}  // namespace mojo


namespace tracing::mojom {
// Interface base classes. They are used for type safety check.
class TracingServiceInterfaceBase {};

using TracingServicePtrDataView =
    mojo::InterfacePtrDataView<TracingServiceInterfaceBase>;
using TracingServiceRequestDataView =
    mojo::InterfaceRequestDataView<TracingServiceInterfaceBase>;
using TracingServiceAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<TracingServiceInterfaceBase>;
using TracingServiceAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<TracingServiceInterfaceBase>;


class ClientInfoDataView {
 public:
  ClientInfoDataView() = default;

  ClientInfoDataView(
      internal::ClientInfo_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  int32_t pid() const {
    return data_->pid;
  }
  template <typename UserType>
  UserType TakeProcess() {
    UserType result;
    bool ret =
        mojo::internal::Deserialize<mojo::InterfacePtrDataView<::tracing::mojom::TracedProcessInterfaceBase>>(
            &data_->process, &result, message_);
    DCHECK(ret);
    return result;
  }
 private:
  internal::ClientInfo_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


}  // tracing::mojom

#endif  // SERVICES_TRACING_PUBLIC_MOJOM_TRACING_SERVICE_MOJOM_DATA_VIEW_H_