chromium/components/performance_manager/execution_context_priority/inherit_parent_priority_voter.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 COMPONENTS_PERFORMANCE_MANAGER_EXECUTION_CONTEXT_PRIORITY_INHERIT_PARENT_PRIORITY_VOTER_H_
#define COMPONENTS_PERFORMANCE_MANAGER_EXECUTION_CONTEXT_PRIORITY_INHERIT_PARENT_PRIORITY_VOTER_H_

#include "components/performance_manager/execution_context_priority/voter_base.h"
#include "components/performance_manager/graph/initializing_frame_node_observer.h"
#include "components/performance_manager/public/execution_context_priority/execution_context_priority.h"
#include "components/performance_manager/public/graph/frame_node.h"

namespace performance_manager::execution_context_priority {

// This class is used to ensure the priority of a child frame when its parent's
// priority is higher.
//
// This is needed to correctly support the use case of using a non-visible
// cross-origin frame to sandbox some of the work that a web application wants
// to do (See https://crbug.com/336161235 for example).
//
// Ad frames do not inherit the priority of their parent as it is not necessary.
class InheritParentPriorityVoter : public VoterBase,
                                   public InitializingFrameNodeObserver {};

}  // namespace performance_manager::execution_context_priority

#endif  // COMPONENTS_PERFORMANCE_MANAGER_EXECUTION_CONTEXT_PRIORITY_INHERIT_PARENT_PRIORITY_VOTER_H_