// third_party/blink/public/mojom/worker/worker_options.mojom.cc is auto generated by mojom_bindings_generator.py, do not edit

// Copyright 2013 The Chromium Authors. All rights reserved.
// 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/worker/worker_options.mojom.h"

#include <math.h>
#include <stdint.h>
#include <utility>

#include "base/hash/md5_constexpr.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/common/task_annotator.h"
#include "base/trace_event/trace_conversion_helper.h"
#include "base/trace_event/traced_value.h"
#include "mojo/public/cpp/bindings/lib/generated_code_util.h"
#include "mojo/public/cpp/bindings/lib/message_internal.h"
#include "mojo/public/cpp/bindings/lib/serialization_util.h"
#include "mojo/public/cpp/bindings/lib/unserialized_message_context.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_context.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h"

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

#include "third_party/blink/public/mojom/worker/worker_options.mojom-import-headers.h"


#ifndef THIRD_PARTY_BLINK_PUBLIC_MOJOM_WORKER_WORKER_OPTIONS_MOJOM_JUMBO_H_
#define THIRD_PARTY_BLINK_PUBLIC_MOJOM_WORKER_WORKER_OPTIONS_MOJOM_JUMBO_H_
#endif
namespace blink {
namespace mojom {
WorkerOptions::WorkerOptions()
    : type(::blink::mojom::ScriptType::kClassic),
      credentials(::network::mojom::CredentialsMode::kSameOrigin),
      name("") {}

WorkerOptions::WorkerOptions(
    ::blink::mojom::ScriptType type_in,
    ::network::mojom::CredentialsMode credentials_in,
    const std::string& name_in)
    : type(std::move(type_in)),
      credentials(std::move(credentials_in)),
      name(std::move(name_in)) {}

WorkerOptions::~WorkerOptions() = default;
size_t WorkerOptions::Hash(size_t seed) const {
  seed = mojo::internal::Hash(seed, this->type);
  seed = mojo::internal::Hash(seed, this->credentials);
  seed = mojo::internal::Hash(seed, this->name);
  return seed;
}

void WorkerOptions::AsValueInto(base::trace_event::TracedValue* value) const {
  value->SetString("type", base::trace_event::ValueToString(this->type));
  value->SetString("credentials", base::trace_event::ValueToString(this->credentials));
  value->SetString("name", this->name);
}

bool WorkerOptions::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  return Data_::Validate(data, validation_context);
}
}  // namespace mojom
}  // namespace blink

namespace mojo {


// static
bool StructTraits<::blink::mojom::WorkerOptions::DataView, ::blink::mojom::WorkerOptionsPtr>::Read(
    ::blink::mojom::WorkerOptions::DataView input,
    ::blink::mojom::WorkerOptionsPtr* output) {
  bool success = true;
  ::blink::mojom::WorkerOptionsPtr result(::blink::mojom::WorkerOptions::New());
  
      if (success && !input.ReadType(&result->type))
        success = false;
      if (success && !input.ReadCredentials(&result->credentials))
        success = false;
      if (success && !input.ReadName(&result->name))
        success = false;
  *output = std::move(result);
  return success;
}

}  // namespace mojo

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