chromium/components/performance_manager/decorators/frame_visibility_decorator.h

// Copyright 2020 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_DECORATORS_FRAME_VISIBILITY_DECORATOR_H_
#define COMPONENTS_PERFORMANCE_MANAGER_DECORATORS_FRAME_VISIBILITY_DECORATOR_H_

#include "components/performance_manager/graph/initializing_frame_node_observer.h"
#include "components/performance_manager/public/decorators/page_live_state_decorator.h"
#include "components/performance_manager/public/graph/frame_node.h"
#include "components/performance_manager/public/graph/graph.h"
#include "components/performance_manager/public/graph/page_node.h"

namespace performance_manager {

// Decorates each frame with their visibility, which is based on its viewport
// intersection and the visibility of the page containing the frame.
//
// A page is considered "user visible" if its `IsVisible()` property is true, or
// if it is being mirrored (PageLiveStateDecorator::Data::IsBeingMirrored).
//
// When the visibility of the frame cannot be determined, it is assigned a value
// of FrameNode::Visibility::kUnknown. This can happen early in the lifetime of
// a frame, where it hasn't been assigned its viewport intersection yet.
class FrameVisibilityDecorator : public GraphOwnedDefaultImpl,
                                 public PageNode::ObserverDefaultImpl,
                                 public PageLiveStateObserver,
                                 public InitializingFrameNodeObserver {};

}  // namespace performance_manager

#endif  // COMPONENTS_PERFORMANCE_MANAGER_DECORATORS_FRAME_VISIBILITY_DECORATOR_H_