chromium/chrome/browser/v8_compile_hints/v8_compile_hints_tab_helper.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 CHROME_BROWSER_V8_COMPILE_HINTS_V8_COMPILE_HINTS_TAB_HELPER_H_
#define CHROME_BROWSER_V8_COMPILE_HINTS_V8_COMPILE_HINTS_TAB_HELPER_H_

#include "base/cancelable_callback.h"
#include "base/feature_list.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "chrome/browser/v8_compile_hints/proto/v8_compile_hints_metadata.pb.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"

namespace optimization_guide {
class OptimizationGuideDecider;
enum class OptimizationGuideDecision;
class OptimizationMetadata;
}  // namespace optimization_guide

namespace content {
class WebContents;
}  // namespace content

// This is inside chrome/browser, because OptimizationGuide is only available
// in chrome.
namespace v8_compile_hints {

// Keep in sync with V8CompileHintsModelQuality in enums.xml.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class V8CompileHintsModelQuality {};

// Observes page load events, requests V8_COMPILE_HINTS data from
// OptimizationGuide, and sends it to the renderer.
//
// All methods must be called from the UI thread.
class V8CompileHintsTabHelper
    : public content::WebContentsObserver,
      public content::WebContentsUserData<V8CompileHintsTabHelper> {};

}  // namespace v8_compile_hints

#endif  // CHROME_BROWSER_V8_COMPILE_HINTS_V8_COMPILE_HINTS_TAB_HELPER_H_