// third_party/blink/public/mojom/input/handwriting_gesture_result.mojom-shared.cc is auto generated by mojom_bindings_generator.py, do not edit

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

#include "third_party/blink/public/mojom/input/handwriting_gesture_result.mojom-shared.h"
#include <ostream>
#include <utility>
#include "base/strings/stringprintf.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/lib/validation_util.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"

#include "third_party/blink/public/mojom/input/handwriting_gesture_result.mojom-params-data.h"
namespace blink {
namespace mojom {

NOINLINE static const char* HandwritingGestureResultToStringHelper(HandwritingGestureResult value) {
  // Defined in a helper function to ensure that Clang generates a lookup table.
  switch(value) {
    case HandwritingGestureResult::kUnknown:
      return "kUnknown";
    case HandwritingGestureResult::kSuccess:
      return "kSuccess";
    case HandwritingGestureResult::kUnsupported:
      return "kUnsupported";
    case HandwritingGestureResult::kFailed:
      return "kFailed";
    case HandwritingGestureResult::kCancelled:
      return "kCancelled";
    case HandwritingGestureResult::kFallback:
      return "kFallback";
    default:
      return nullptr;
  }
}

std::string HandwritingGestureResultToString(HandwritingGestureResult value) {
  const char *str = HandwritingGestureResultToStringHelper(value);
  if (!str) {
    return base::StringPrintf("Unknown HandwritingGestureResult value: %i", static_cast<int32_t>(value));
  }
  return str;
}

std::ostream& operator<<(std::ostream& os, HandwritingGestureResult value) {
  return os << HandwritingGestureResultToString(value);
}

namespace internal {

}  // namespace internal
}  // namespace mojom
}  // namespace blink

namespace perfetto {

// static
void TraceFormatTraits<::blink::mojom::HandwritingGestureResult>::WriteIntoTrace(
   perfetto::TracedValue context, ::blink::mojom::HandwritingGestureResult value) {
  return std::move(context).WriteString(::blink::mojom::HandwritingGestureResultToString(value));
}

} // namespace perfetto