// services/viz/privileged/mojom/compositing/display_private.mojom.h is auto generated by mojom_bindings_generator.py, do not edit

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef SERVICES_VIZ_PRIVILEGED_MOJOM_COMPOSITING_DISPLAY_PRIVATE_MOJOM_H_
#define SERVICES_VIZ_PRIVILEGED_MOJOM_COMPOSITING_DISPLAY_PRIVATE_MOJOM_H_

#include <stdint.h>

#include <limits>
#include <optional>
#include <type_traits>
#include <utility>
#include "mojo/public/cpp/bindings/clone_traits.h"
#include "mojo/public/cpp/bindings/equals_traits.h"
#include "mojo/public/cpp/bindings/struct_ptr.h"
#include "mojo/public/cpp/bindings/struct_traits.h"
#include "mojo/public/cpp/bindings/union_traits.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"

#include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h"

#include "services/viz/privileged/mojom/compositing/display_private.mojom-features.h"  // IWYU pragma: export
#include "services/viz/privileged/mojom/compositing/display_private.mojom-shared.h"  // IWYU pragma: export
#include "services/viz/privileged/mojom/compositing/display_private.mojom-forward.h"  // IWYU pragma: export
#include "gpu/ipc/common/context_result.mojom.h"
#include "gpu/ipc/common/surface_handle.mojom-forward.h"
#include "mojo/public/mojom/base/time.mojom.h"
#include "ui/display/mojom/display_constants.mojom.h"
#include "ui/gfx/mojom/ca_layer_params.mojom-forward.h"
#include "ui/gfx/mojom/delegated_ink_point_renderer.mojom-forward.h"
#include "ui/gfx/mojom/display_color_spaces.mojom.h"
#include "ui/gfx/mojom/overlay_transform.mojom-forward.h"
#include "ui/gfx/mojom/transform.mojom.h"
#include "ui/gfx/geometry/mojom/geometry.mojom.h"
#include "ui/latency/mojom/latency_info.mojom-forward.h"
#include "services/viz/privileged/mojom/compositing/begin_frame_observer.mojom-forward.h"
#include "services/viz/privileged/mojom/compositing/layered_window_updater.mojom-forward.h"
#include "services/viz/privileged/mojom/compositing/vsync_parameter_observer.mojom-forward.h"
#include <string>
#include <vector>

#include "mojo/public/cpp/bindings/lib/control_message_handler.h"
#include "mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h"






namespace viz::mojom {

class DisplayPrivateProxy;

template <typename ImplRefTraits>
class DisplayPrivateStub;

class DisplayPrivateRequestValidator;


class DisplayPrivate
    : public DisplayPrivateInterfaceBase {
 public:
  using IPCStableHashFunction = uint32_t(*)();
  static constexpr const char* Name_ = "viz.mojom.DisplayPrivate";
  static IPCStableHashFunction MessageToMethodInfo_(mojo::Message& message);
  static const char* MessageToMethodName_(mojo::Message& message);
  static constexpr uint32_t Version_ = 0;
  static constexpr bool PassesAssociatedKinds_ = false;
  static constexpr bool HasUninterruptableMethods_ = false;

  using Base_ = DisplayPrivateInterfaceBase;
  using Proxy_ = DisplayPrivateProxy;

  template <typename ImplRefTraits>
  using Stub_ = DisplayPrivateStub<ImplRefTraits>;

  using RequestValidator_ = DisplayPrivateRequestValidator;
  using ResponseValidator_ = mojo::PassThroughFilter;
  enum MethodMinVersions : uint32_t {
    kSetDisplayVisibleMinVersion = 0,
    kResizeMinVersion = 0,
    kSetDisplayColorMatrixMinVersion = 0,
    kSetDisplayColorSpacesMinVersion = 0,
    kSetOutputIsSecureMinVersion = 0,
    kSetDisplayVSyncParametersMinVersion = 0,
    kForceImmediateDrawAndSwapIfPossibleMinVersion = 0,
    kUpdateRefreshRateMinVersion = 0,
    kSetAdaptiveRefreshRateInfoMinVersion = 0,
    kSetSupportedRefreshRatesMinVersion = 0,
    kPreserveChildSurfaceControlsMinVersion = 0,
    kSetSwapCompletionCallbackEnabledMinVersion = 0,
    kAddVSyncParameterObserverMinVersion = 0,
    kSetDelegatedInkPointRendererMinVersion = 0,
    kSetStandaloneBeginFrameObserverMinVersion = 0,
    kSetMaxVSyncAndVrrMinVersion = 0,
  };

// crbug.com/1340245 - this causes binary size bloat on Fuchsia, and we're OK
// with not having this data in traces there.
#if !BUILDFLAG(IS_FUCHSIA)
  struct SetDisplayVisible_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct Resize_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct SetDisplayColorMatrix_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct SetDisplayColorSpaces_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct SetOutputIsSecure_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct SetDisplayVSyncParameters_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct ForceImmediateDrawAndSwapIfPossible_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct UpdateRefreshRate_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct SetAdaptiveRefreshRateInfo_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct SetSupportedRefreshRates_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct PreserveChildSurfaceControls_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct SetSwapCompletionCallbackEnabled_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct AddVSyncParameterObserver_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct SetDelegatedInkPointRenderer_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct SetStandaloneBeginFrameObserver_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct SetMaxVSyncAndVrr_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
#endif // !BUILDFLAG(IS_FUCHSIA)
  virtual ~DisplayPrivate() = default;

  virtual void SetDisplayVisible(bool visible) = 0;

  virtual void Resize(const ::gfx::Size& size) = 0;

  virtual void SetDisplayColorMatrix(const ::gfx::Transform& color_matrix) = 0;

  virtual void SetDisplayColorSpaces(const ::gfx::DisplayColorSpaces& display_color_spaces) = 0;

  virtual void SetOutputIsSecure(bool secure) = 0;

  virtual void SetDisplayVSyncParameters(::base::TimeTicks timebase, ::base::TimeDelta interval) = 0;

  virtual void ForceImmediateDrawAndSwapIfPossible() = 0;

  virtual void UpdateRefreshRate(float refresh_rate) = 0;

  virtual void SetAdaptiveRefreshRateInfo(AdaptiveRefreshRateInfoPtr info) = 0;

  virtual void SetSupportedRefreshRates(const std::vector<float>& refresh_rates) = 0;

  virtual void PreserveChildSurfaceControls() = 0;

  virtual void SetSwapCompletionCallbackEnabled(bool enable) = 0;

  virtual void AddVSyncParameterObserver(::mojo::PendingRemote<::viz::mojom::VSyncParameterObserver> observer) = 0;

  virtual void SetDelegatedInkPointRenderer(::mojo::PendingReceiver<::gfx::mojom::DelegatedInkPointRenderer> receiver) = 0;

  virtual void SetStandaloneBeginFrameObserver(::mojo::PendingRemote<::viz::mojom::BeginFrameObserver> observer) = 0;

  virtual void SetMaxVSyncAndVrr(std::optional<::base::TimeDelta> max_vsync_interval, ::display::VariableRefreshRateState vrr_state) = 0;
};

class DisplayClientProxy;

template <typename ImplRefTraits>
class DisplayClientStub;

class DisplayClientRequestValidator;


class DisplayClient
    : public DisplayClientInterfaceBase {
 public:
  using IPCStableHashFunction = uint32_t(*)();
  static constexpr const char* Name_ = "viz.mojom.DisplayClient";
  static IPCStableHashFunction MessageToMethodInfo_(mojo::Message& message);
  static const char* MessageToMethodName_(mojo::Message& message);
  static constexpr uint32_t Version_ = 0;
  static constexpr bool PassesAssociatedKinds_ = false;
  static constexpr bool HasUninterruptableMethods_ = false;

  using Base_ = DisplayClientInterfaceBase;
  using Proxy_ = DisplayClientProxy;

  template <typename ImplRefTraits>
  using Stub_ = DisplayClientStub<ImplRefTraits>;

  using RequestValidator_ = DisplayClientRequestValidator;
  using ResponseValidator_ = mojo::PassThroughFilter;
  enum MethodMinVersions : uint32_t {
    kDidCompleteSwapWithSizeMinVersion = 0,
    kOnContextCreationResultMinVersion = 0,
    kSetWideColorEnabledMinVersion = 0,
    kSetPreferredRefreshRateMinVersion = 0,
  };

// crbug.com/1340245 - this causes binary size bloat on Fuchsia, and we're OK
// with not having this data in traces there.
#if !BUILDFLAG(IS_FUCHSIA)
  struct DidCompleteSwapWithSize_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct OnContextCreationResult_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct SetWideColorEnabled_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct SetPreferredRefreshRate_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
#endif // !BUILDFLAG(IS_FUCHSIA)
  virtual ~DisplayClient() = default;

  virtual void DidCompleteSwapWithSize(const ::gfx::Size& size) = 0;

  virtual void OnContextCreationResult(::gpu::ContextResult result) = 0;

  virtual void SetWideColorEnabled(bool enabled) = 0;

  virtual void SetPreferredRefreshRate(float refresh_rate) = 0;
};



class  DisplayPrivateProxy
    : public DisplayPrivate {
 public:
  using InterfaceType = DisplayPrivate;

  explicit DisplayPrivateProxy(mojo::MessageReceiverWithResponder* receiver);
  
  void SetDisplayVisible(bool visible) final;
  
  void Resize(const ::gfx::Size& size) final;
  
  void SetDisplayColorMatrix(const ::gfx::Transform& color_matrix) final;
  
  void SetDisplayColorSpaces(const ::gfx::DisplayColorSpaces& display_color_spaces) final;
  
  void SetOutputIsSecure(bool secure) final;
  
  void SetDisplayVSyncParameters(::base::TimeTicks timebase, ::base::TimeDelta interval) final;
  
  void ForceImmediateDrawAndSwapIfPossible() final;
  
  void UpdateRefreshRate(float refresh_rate) final;
  
  void SetAdaptiveRefreshRateInfo(AdaptiveRefreshRateInfoPtr info) final;
  
  void SetSupportedRefreshRates(const std::vector<float>& refresh_rates) final;
  
  void PreserveChildSurfaceControls() final;
  
  void SetSwapCompletionCallbackEnabled(bool enable) final;
  
  void AddVSyncParameterObserver(::mojo::PendingRemote<::viz::mojom::VSyncParameterObserver> observer) final;
  
  void SetDelegatedInkPointRenderer(::mojo::PendingReceiver<::gfx::mojom::DelegatedInkPointRenderer> receiver) final;
  
  void SetStandaloneBeginFrameObserver(::mojo::PendingRemote<::viz::mojom::BeginFrameObserver> observer) final;
  
  void SetMaxVSyncAndVrr(std::optional<::base::TimeDelta> max_vsync_interval, ::display::VariableRefreshRateState vrr_state) final;

 private:
  mojo::MessageReceiverWithResponder* receiver_;
};



class  DisplayClientProxy
    : public DisplayClient {
 public:
  using InterfaceType = DisplayClient;

  explicit DisplayClientProxy(mojo::MessageReceiverWithResponder* receiver);
  
  void DidCompleteSwapWithSize(const ::gfx::Size& size) final;
  
  void OnContextCreationResult(::gpu::ContextResult result) final;
  
  void SetWideColorEnabled(bool enabled) final;
  
  void SetPreferredRefreshRate(float refresh_rate) final;

 private:
  mojo::MessageReceiverWithResponder* receiver_;
};
class  DisplayPrivateStubDispatch {
 public:
  static bool Accept(DisplayPrivate* impl, mojo::Message* message);
  static bool AcceptWithResponder(
      DisplayPrivate* impl,
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder);
};

template <typename ImplRefTraits =
              mojo::RawPtrImplRefTraits<DisplayPrivate>>
class DisplayPrivateStub
    : public mojo::MessageReceiverWithResponderStatus {
 public:
  using ImplPointerType = typename ImplRefTraits::PointerType;

  DisplayPrivateStub() = default;
  ~DisplayPrivateStub() override = default;

  void set_sink(ImplPointerType sink) { sink_ = std::move(sink); }
  ImplPointerType& sink() { return sink_; }

  bool Accept(mojo::Message* message) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return DisplayPrivateStubDispatch::Accept(
        ImplRefTraits::GetRawPointer(&sink_), message);
  }

  bool AcceptWithResponder(
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return DisplayPrivateStubDispatch::AcceptWithResponder(
        ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder));
  }

 private:
  ImplPointerType sink_;
};
class  DisplayClientStubDispatch {
 public:
  static bool Accept(DisplayClient* impl, mojo::Message* message);
  static bool AcceptWithResponder(
      DisplayClient* impl,
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder);
};

template <typename ImplRefTraits =
              mojo::RawPtrImplRefTraits<DisplayClient>>
class DisplayClientStub
    : public mojo::MessageReceiverWithResponderStatus {
 public:
  using ImplPointerType = typename ImplRefTraits::PointerType;

  DisplayClientStub() = default;
  ~DisplayClientStub() override = default;

  void set_sink(ImplPointerType sink) { sink_ = std::move(sink); }
  ImplPointerType& sink() { return sink_; }

  bool Accept(mojo::Message* message) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return DisplayClientStubDispatch::Accept(
        ImplRefTraits::GetRawPointer(&sink_), message);
  }

  bool AcceptWithResponder(
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return DisplayClientStubDispatch::AcceptWithResponder(
        ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder));
  }

 private:
  ImplPointerType sink_;
};
class  DisplayPrivateRequestValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};
class  DisplayClientRequestValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};





class  FrameRateVelocityPoint {
 public:
  template <typename T>
  using EnableIfSame = std::enable_if_t<std::is_same<FrameRateVelocityPoint, T>::value>;
  using DataView = FrameRateVelocityPointDataView;
  using Data_ = internal::FrameRateVelocityPoint_Data;

  template <typename... Args>
  static FrameRateVelocityPointPtr New(Args&&... args) {
    return FrameRateVelocityPointPtr(
        std::in_place, std::forward<Args>(args)...);
  }

  template <typename U>
  static FrameRateVelocityPointPtr From(const U& u) {
    return mojo::TypeConverter<FrameRateVelocityPointPtr, U>::Convert(u);
  }

  template <typename U>
  U To() const {
    return mojo::TypeConverter<U, FrameRateVelocityPoint>::Convert(*this);
  }


  FrameRateVelocityPoint();

  FrameRateVelocityPoint(
      float frame_per_second,
      float dp_per_second);


  ~FrameRateVelocityPoint();

  // Clone() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Clone() or copy
  // constructor/assignment are available for members.
  template <typename StructPtrType = FrameRateVelocityPointPtr>
  FrameRateVelocityPointPtr Clone() const;

  // Equals() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Equals() or == operator
  // are available for members.
  template <typename T, FrameRateVelocityPoint::EnableIfSame<T>* = nullptr>
  bool Equals(const T& other) const;

  template <typename T, FrameRateVelocityPoint::EnableIfSame<T>* = nullptr>
  bool operator==(const T& rhs) const { return Equals(rhs); }

  template <typename T, FrameRateVelocityPoint::EnableIfSame<T>* = nullptr>
  bool operator!=(const T& rhs) const { return !operator==(rhs); }
  size_t Hash(size_t seed) const;

  template <mojo::internal::SendValidation send_validation, typename UserType>
  static std::vector<uint8_t> Serialize(UserType* input) {
    return mojo::internal::SerializeImpl<
        FrameRateVelocityPoint::DataView, std::vector<uint8_t>, send_validation>(input);
  }

  template <typename UserType>
  static std::vector<uint8_t> Serialize(UserType* input) {
    return mojo::internal::SerializeImpl<
        FrameRateVelocityPoint::DataView, std::vector<uint8_t>>(input);
  }

  template <typename UserType>
  static mojo::Message SerializeAsMessage(UserType* input) {
    return mojo::internal::SerializeAsMessageImpl<
        FrameRateVelocityPoint::DataView>(input);
  }

  // The returned Message is serialized only if the message is moved
  // cross-process or cross-language. Otherwise if the message is Deserialized
  // as the same UserType |input| will just be moved to |output| in
  // DeserializeFromMessage.
  template <typename UserType>
  static mojo::Message WrapAsMessage(UserType input) {
    return mojo::Message(std::make_unique<
        internal::FrameRateVelocityPoint_UnserializedMessageContext<
            UserType, FrameRateVelocityPoint::DataView>>(0, 0, std::move(input)),
        MOJO_CREATE_MESSAGE_FLAG_NONE);
  }

  template <typename UserType>
  static bool Deserialize(const void* data,
                          size_t data_num_bytes,
                          UserType* output) {
    mojo::Message message;
    return mojo::internal::DeserializeImpl<FrameRateVelocityPoint::DataView>(
        message, data, data_num_bytes, output, Validate);
  }

  template <typename UserType>
  static bool Deserialize(base::span<const uint8_t> input,
                          UserType* output) {
    return FrameRateVelocityPoint::Deserialize(
        input.empty() ? nullptr : input.data(), input.size(), output);
  }

  template <typename UserType>
  static bool DeserializeFromMessage(mojo::Message input,
                                     UserType* output) {
    auto context = input.TakeUnserializedContext<
        internal::FrameRateVelocityPoint_UnserializedMessageContext<
            UserType, FrameRateVelocityPoint::DataView>>();
    if (context) {
      *output = std::move(context->TakeData());
      return true;
    }
    input.SerializeIfNecessary();
    return mojo::internal::DeserializeImpl<FrameRateVelocityPoint::DataView>(
        input, input.payload(), input.payload_num_bytes(), output, Validate);
  }

  
  float frame_per_second;
  
  float dp_per_second;

  // Serialise this struct into a trace.
  void WriteIntoTrace(perfetto::TracedValue traced_context) const;

 private:
  static bool Validate(const void* data,
                       mojo::internal::ValidationContext* validation_context);
};

// The comparison operators are templates, so they are only instantiated if they
// are used. Thus, the bindings generator does not need to know whether
// comparison operators are available for members.
template <typename T, FrameRateVelocityPoint::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);

template <typename T, FrameRateVelocityPoint::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
  return !(rhs < lhs);
}

template <typename T, FrameRateVelocityPoint::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
  return rhs < lhs;
}

template <typename T, FrameRateVelocityPoint::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
  return !(lhs < rhs);
}









class  AdaptiveRefreshRateInfo {
 public:
  template <typename T>
  using EnableIfSame = std::enable_if_t<std::is_same<AdaptiveRefreshRateInfo, T>::value>;
  using DataView = AdaptiveRefreshRateInfoDataView;
  using Data_ = internal::AdaptiveRefreshRateInfo_Data;

  template <typename... Args>
  static AdaptiveRefreshRateInfoPtr New(Args&&... args) {
    return AdaptiveRefreshRateInfoPtr(
        std::in_place, std::forward<Args>(args)...);
  }

  template <typename U>
  static AdaptiveRefreshRateInfoPtr From(const U& u) {
    return mojo::TypeConverter<AdaptiveRefreshRateInfoPtr, U>::Convert(u);
  }

  template <typename U>
  U To() const {
    return mojo::TypeConverter<U, AdaptiveRefreshRateInfo>::Convert(*this);
  }


  AdaptiveRefreshRateInfo();

  AdaptiveRefreshRateInfo(
      bool has_support,
      float suggested_high,
      std::vector<FrameRateVelocityPointPtr> velocity_mapping,
      float device_scale_factor);

AdaptiveRefreshRateInfo(const AdaptiveRefreshRateInfo&) = delete;
AdaptiveRefreshRateInfo& operator=(const AdaptiveRefreshRateInfo&) = delete;

  ~AdaptiveRefreshRateInfo();

  // Clone() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Clone() or copy
  // constructor/assignment are available for members.
  template <typename StructPtrType = AdaptiveRefreshRateInfoPtr>
  AdaptiveRefreshRateInfoPtr Clone() const;

  // Equals() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Equals() or == operator
  // are available for members.
  template <typename T, AdaptiveRefreshRateInfo::EnableIfSame<T>* = nullptr>
  bool Equals(const T& other) const;

  template <typename T, AdaptiveRefreshRateInfo::EnableIfSame<T>* = nullptr>
  bool operator==(const T& rhs) const { return Equals(rhs); }

  template <typename T, AdaptiveRefreshRateInfo::EnableIfSame<T>* = nullptr>
  bool operator!=(const T& rhs) const { return !operator==(rhs); }

  template <mojo::internal::SendValidation send_validation, typename UserType>
  static std::vector<uint8_t> Serialize(UserType* input) {
    return mojo::internal::SerializeImpl<
        AdaptiveRefreshRateInfo::DataView, std::vector<uint8_t>, send_validation>(input);
  }

  template <typename UserType>
  static std::vector<uint8_t> Serialize(UserType* input) {
    return mojo::internal::SerializeImpl<
        AdaptiveRefreshRateInfo::DataView, std::vector<uint8_t>>(input);
  }

  template <typename UserType>
  static mojo::Message SerializeAsMessage(UserType* input) {
    return mojo::internal::SerializeAsMessageImpl<
        AdaptiveRefreshRateInfo::DataView>(input);
  }

  // The returned Message is serialized only if the message is moved
  // cross-process or cross-language. Otherwise if the message is Deserialized
  // as the same UserType |input| will just be moved to |output| in
  // DeserializeFromMessage.
  template <typename UserType>
  static mojo::Message WrapAsMessage(UserType input) {
    return mojo::Message(std::make_unique<
        internal::AdaptiveRefreshRateInfo_UnserializedMessageContext<
            UserType, AdaptiveRefreshRateInfo::DataView>>(0, 0, std::move(input)),
        MOJO_CREATE_MESSAGE_FLAG_NONE);
  }

  template <typename UserType>
  static bool Deserialize(const void* data,
                          size_t data_num_bytes,
                          UserType* output) {
    mojo::Message message;
    return mojo::internal::DeserializeImpl<AdaptiveRefreshRateInfo::DataView>(
        message, data, data_num_bytes, output, Validate);
  }

  template <typename UserType>
  static bool Deserialize(base::span<const uint8_t> input,
                          UserType* output) {
    return AdaptiveRefreshRateInfo::Deserialize(
        input.empty() ? nullptr : input.data(), input.size(), output);
  }

  template <typename UserType>
  static bool DeserializeFromMessage(mojo::Message input,
                                     UserType* output) {
    auto context = input.TakeUnserializedContext<
        internal::AdaptiveRefreshRateInfo_UnserializedMessageContext<
            UserType, AdaptiveRefreshRateInfo::DataView>>();
    if (context) {
      *output = std::move(context->TakeData());
      return true;
    }
    input.SerializeIfNecessary();
    return mojo::internal::DeserializeImpl<AdaptiveRefreshRateInfo::DataView>(
        input, input.payload(), input.payload_num_bytes(), output, Validate);
  }

  
  bool has_support;
  
  float suggested_high;
  
  std::vector<FrameRateVelocityPointPtr> velocity_mapping;
  
  float device_scale_factor;

  // Serialise this struct into a trace.
  void WriteIntoTrace(perfetto::TracedValue traced_context) const;

 private:
  static bool Validate(const void* data,
                       mojo::internal::ValidationContext* validation_context);
};

// The comparison operators are templates, so they are only instantiated if they
// are used. Thus, the bindings generator does not need to know whether
// comparison operators are available for members.
template <typename T, AdaptiveRefreshRateInfo::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);

template <typename T, AdaptiveRefreshRateInfo::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
  return !(rhs < lhs);
}

template <typename T, AdaptiveRefreshRateInfo::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
  return rhs < lhs;
}

template <typename T, AdaptiveRefreshRateInfo::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
  return !(lhs < rhs);
}

template <typename StructPtrType>
FrameRateVelocityPointPtr FrameRateVelocityPoint::Clone() const {
  return New(
      mojo::Clone(frame_per_second),
      mojo::Clone(dp_per_second)
  );
}

template <typename T, FrameRateVelocityPoint::EnableIfSame<T>*>
bool FrameRateVelocityPoint::Equals(const T& other_struct) const {
  if (!mojo::Equals(this->frame_per_second, other_struct.frame_per_second))
    return false;
  if (!mojo::Equals(this->dp_per_second, other_struct.dp_per_second))
    return false;
  return true;
}

template <typename T, FrameRateVelocityPoint::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
  if (lhs.frame_per_second < rhs.frame_per_second)
    return true;
  if (rhs.frame_per_second < lhs.frame_per_second)
    return false;
  if (lhs.dp_per_second < rhs.dp_per_second)
    return true;
  if (rhs.dp_per_second < lhs.dp_per_second)
    return false;
  return false;
}
template <typename StructPtrType>
AdaptiveRefreshRateInfoPtr AdaptiveRefreshRateInfo::Clone() const {
  return New(
      mojo::Clone(has_support),
      mojo::Clone(suggested_high),
      mojo::Clone(velocity_mapping),
      mojo::Clone(device_scale_factor)
  );
}

template <typename T, AdaptiveRefreshRateInfo::EnableIfSame<T>*>
bool AdaptiveRefreshRateInfo::Equals(const T& other_struct) const {
  if (!mojo::Equals(this->has_support, other_struct.has_support))
    return false;
  if (!mojo::Equals(this->suggested_high, other_struct.suggested_high))
    return false;
  if (!mojo::Equals(this->velocity_mapping, other_struct.velocity_mapping))
    return false;
  if (!mojo::Equals(this->device_scale_factor, other_struct.device_scale_factor))
    return false;
  return true;
}

template <typename T, AdaptiveRefreshRateInfo::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
  if (lhs.has_support < rhs.has_support)
    return true;
  if (rhs.has_support < lhs.has_support)
    return false;
  if (lhs.suggested_high < rhs.suggested_high)
    return true;
  if (rhs.suggested_high < lhs.suggested_high)
    return false;
  if (lhs.velocity_mapping < rhs.velocity_mapping)
    return true;
  if (rhs.velocity_mapping < lhs.velocity_mapping)
    return false;
  if (lhs.device_scale_factor < rhs.device_scale_factor)
    return true;
  if (rhs.device_scale_factor < lhs.device_scale_factor)
    return false;
  return false;
}


}  // viz::mojom

namespace mojo {


template <>
struct  StructTraits<::viz::mojom::FrameRateVelocityPoint::DataView,
                                         ::viz::mojom::FrameRateVelocityPointPtr> {
  static bool IsNull(const ::viz::mojom::FrameRateVelocityPointPtr& input) { return !input; }
  static void SetToNull(::viz::mojom::FrameRateVelocityPointPtr* output) { output->reset(); }

  static decltype(::viz::mojom::FrameRateVelocityPoint::frame_per_second) frame_per_second(
      const ::viz::mojom::FrameRateVelocityPointPtr& input) {
    return input->frame_per_second;
  }

  static decltype(::viz::mojom::FrameRateVelocityPoint::dp_per_second) dp_per_second(
      const ::viz::mojom::FrameRateVelocityPointPtr& input) {
    return input->dp_per_second;
  }

  static bool Read(::viz::mojom::FrameRateVelocityPoint::DataView input, ::viz::mojom::FrameRateVelocityPointPtr* output);
};


template <>
struct  StructTraits<::viz::mojom::AdaptiveRefreshRateInfo::DataView,
                                         ::viz::mojom::AdaptiveRefreshRateInfoPtr> {
  static bool IsNull(const ::viz::mojom::AdaptiveRefreshRateInfoPtr& input) { return !input; }
  static void SetToNull(::viz::mojom::AdaptiveRefreshRateInfoPtr* output) { output->reset(); }

  static decltype(::viz::mojom::AdaptiveRefreshRateInfo::has_support) has_support(
      const ::viz::mojom::AdaptiveRefreshRateInfoPtr& input) {
    return input->has_support;
  }

  static decltype(::viz::mojom::AdaptiveRefreshRateInfo::suggested_high) suggested_high(
      const ::viz::mojom::AdaptiveRefreshRateInfoPtr& input) {
    return input->suggested_high;
  }

  static const decltype(::viz::mojom::AdaptiveRefreshRateInfo::velocity_mapping)& velocity_mapping(
      const ::viz::mojom::AdaptiveRefreshRateInfoPtr& input) {
    return input->velocity_mapping;
  }

  static decltype(::viz::mojom::AdaptiveRefreshRateInfo::device_scale_factor) device_scale_factor(
      const ::viz::mojom::AdaptiveRefreshRateInfoPtr& input) {
    return input->device_scale_factor;
  }

  static bool Read(::viz::mojom::AdaptiveRefreshRateInfo::DataView input, ::viz::mojom::AdaptiveRefreshRateInfoPtr* output);
};

}  // namespace mojo

#endif  // SERVICES_VIZ_PRIVILEGED_MOJOM_COMPOSITING_DISPLAY_PRIVATE_MOJOM_H_