chromium/third_party/blink/renderer/modules/ml/ml_trace.h

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

#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_ML_ML_TRACE_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_ML_ML_TRACE_H_

#include <memory>
#include <optional>

#include "third_party/blink/renderer/modules/modules_export.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_copier_base.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"

namespace blink {

// The trace starts when an object of this class is created, and ends when
// the object goes out scope.
// You should 'std::move' this object when binding callbacks. The trace ends
// if the callback is destroyed (even if it's not run).
//
// Methods in this class is safe to be called from any threads.
class MODULES_EXPORT ScopedMLTrace {};

}  // namespace blink

namespace WTF {

template <>
struct CrossThreadCopier<blink::ScopedMLTrace>
    : public WTF::CrossThreadCopierByValuePassThrough<blink::ScopedMLTrace> {};

}  // namespace WTF

#endif  // THIRD_PARTY_BLINK_RENDERER_MODULES_ML_ML_TRACE_H_