chromium/content/services/auction_worklet/auction_v8_logger.h

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

#ifndef CONTENT_SERVICES_AUCTION_WORKLET_AUCTION_V8_LOGGER_H_
#define CONTENT_SERVICES_AUCTION_WORKLET_AUCTION_V8_LOGGER_H_

#include <string_view>

#include "base/memory/raw_ptr.h"
#include "content/common/content_export.h"
#include "v8/include/v8-context.h"
#include "v8/include/v8-function.h"
#include "v8/include/v8-persistent-handle.h"

namespace auction_worklet {

class AuctionV8Helper;

// Helper class to log text to the console by using methods from the `console`
// object. Must be destroyed before the associated v8::Context, and created
// before the context has been used to run any scripts, as scripts can modify or
// replace the console object. Uses a v8::Global to persist past the Isolate's
// HandleScope. To ensure it's created at the right time should only call
// immediately after AuctionV8Logger::CreateContext().
//
// Its logging methods are expected to be invoked in C++ methods that are
// invoked from Javascript, while the v8::Context used to create logger is
// active.
class CONTENT_EXPORT AuctionV8Logger {};

}  // namespace auction_worklet

#endif  // CONTENT_SERVICES_AUCTION_WORKLET_AUCTION_V8_LOGGER_H_