// components/metrics/public/mojom/call_stack_profile_collector.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 COMPONENTS_METRICS_PUBLIC_MOJOM_CALL_STACK_PROFILE_COLLECTOR_MOJOM_DATA_VIEW_H_
#define COMPONENTS_METRICS_PUBLIC_MOJOM_CALL_STACK_PROFILE_COLLECTOR_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 "components/metrics/public/mojom/call_stack_profile_collector.mojom-shared-internal.h"
#include "components/metrics/public/mojom/profile_params.mojom-shared.h"
#include "mojo/public/mojom/base/proto_wrapper.mojom-shared.h"
#include "mojo/public/mojom/base/time.mojom-shared.h"


namespace metrics::mojom {
class SampledProfileDataView;



}  // metrics::mojom


namespace mojo {
namespace internal {

template <>
struct MojomTypeTraits<::metrics::mojom::SampledProfileDataView> {
  using Data = ::metrics::mojom::internal::SampledProfile_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

}  // namespace internal
}  // namespace mojo


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

using CallStackProfileCollectorPtrDataView =
    mojo::InterfacePtrDataView<CallStackProfileCollectorInterfaceBase>;
using CallStackProfileCollectorRequestDataView =
    mojo::InterfaceRequestDataView<CallStackProfileCollectorInterfaceBase>;
using CallStackProfileCollectorAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<CallStackProfileCollectorInterfaceBase>;
using CallStackProfileCollectorAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<CallStackProfileCollectorInterfaceBase>;


class SampledProfileDataView {
 public:
  SampledProfileDataView() = default;

  SampledProfileDataView(
      internal::SampledProfile_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  inline void GetContentsDataView(
      ::mojo_base::mojom::ProtoWrapperDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadContents(UserType* output) {
    
    auto* pointer = data_->contents.Get();
    return mojo::internal::Deserialize<::mojo_base::mojom::ProtoWrapperDataView>(
        pointer, output, message_);
  }
 private:
  internal::SampledProfile_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


}  // metrics::mojom

#endif  // COMPONENTS_METRICS_PUBLIC_MOJOM_CALL_STACK_PROFILE_COLLECTOR_MOJOM_DATA_VIEW_H_