// third_party/blink/public/mojom/page/prerender_page_param.mojom-blink.cc 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.

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif

#include "third_party/blink/public/mojom/page/prerender_page_param.mojom-blink.h"
#include <stdint.h>
#include <utility>
#include "mojo/public/cpp/bindings/lib/default_construct_tag_internal.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/mojo_buildflags.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"

#include "third_party/blink/public/mojom/page/prerender_page_param.mojom-params-data.h"
#include "third_party/blink/public/mojom/page/prerender_page_param.mojom-shared-message-ids.h"

#include "third_party/blink/public/mojom/page/prerender_page_param.mojom-blink-import-headers.h"
#include "third_party/blink/public/mojom/page/prerender_page_param.mojom-blink-test-utils.h"
#include "mojo/public/cpp/bindings/lib/wtf_serialization.h"


namespace blink::mojom::blink {
PrerenderParam::PrerenderParam()
    : page_metric_suffix(),
      should_warm_up_compositor(),
      should_prepare_paint_tree(),
      should_pause_javascript_execution() {}

PrerenderParam::PrerenderParam(
    const ::blink::String& page_metric_suffix_in,
    bool should_warm_up_compositor_in,
    bool should_prepare_paint_tree_in,
    bool should_pause_javascript_execution_in)
    : page_metric_suffix(std::move(page_metric_suffix_in)),
      should_warm_up_compositor(std::move(should_warm_up_compositor_in)),
      should_prepare_paint_tree(std::move(should_prepare_paint_tree_in)),
      should_pause_javascript_execution(std::move(should_pause_javascript_execution_in)) {}

PrerenderParam::~PrerenderParam() = default;
size_t PrerenderParam::Hash(size_t seed) const {
  seed = mojo::internal::WTFHash(seed, this->page_metric_suffix);
  seed = mojo::internal::WTFHash(seed, this->should_warm_up_compositor);
  seed = mojo::internal::WTFHash(seed, this->should_prepare_paint_tree);
  seed = mojo::internal::WTFHash(seed, this->should_pause_javascript_execution);
  return seed;
}

void PrerenderParam::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "page_metric_suffix"), this->page_metric_suffix,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::blink::String&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "should_warm_up_compositor"), this->should_warm_up_compositor,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "should_prepare_paint_tree"), this->should_prepare_paint_tree,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "should_pause_javascript_execution"), this->should_pause_javascript_execution,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

bool PrerenderParam::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  return Data_::Validate(data, validation_context);
}


}  // blink::mojom::blink


namespace mojo {


// static
bool StructTraits<::blink::mojom::blink::PrerenderParam::DataView, ::blink::mojom::blink::PrerenderParamPtr>::Read(
    ::blink::mojom::blink::PrerenderParam::DataView input,
    ::blink::mojom::blink::PrerenderParamPtr* output) {
  bool success = true;
  ::blink::mojom::blink::PrerenderParamPtr result(::blink::mojom::blink::PrerenderParam::New());
  
      if (success && !input.ReadPageMetricSuffix(&result->page_metric_suffix))
        success = false;
      if (success)
        result->should_warm_up_compositor = input.should_warm_up_compositor();
      if (success)
        result->should_prepare_paint_tree = input.should_prepare_paint_tree();
      if (success)
        result->should_pause_javascript_execution = input.should_pause_javascript_execution();
  *output = std::move(result);
  return success;
}

}  // namespace mojo


// Symbols declared in the -test-utils.h header are defined here instead of a
// separate .cc file to save compile time.


namespace blink::mojom::blink {




}  // blink::mojom::blink


#if defined(__clang__)
#pragma clang diagnostic pop
#endif