chromium/chrome/browser/performance_manager/policies/background_tab_loading_policy.cc

// 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.

#include "chrome/browser/performance_manager/policies/background_tab_loading_policy.h"

#include <vector>

#include "base/containers/contains.h"
#include "base/numerics/safe_conversions.h"
#include "base/system/sys_info.h"
#include "base/time/time.h"
#include "chrome/browser/performance_manager/mechanisms/page_loader.h"
#include "chrome/browser/performance_manager/policies/background_tab_loading_policy_helpers.h"
#include "chrome/browser/profiles/profile.h"
#include "components/performance_manager/graph/page_node_impl.h"
#include "components/performance_manager/public/decorators/site_data_recorder.h"
#include "components/performance_manager/public/graph/node_data_describer_registry.h"
#include "components/performance_manager/public/graph/policies/background_tab_loading_policy.h"
#include "components/performance_manager/public/performance_manager.h"
#include "components/performance_manager/public/persistence/site_data/site_data_reader.h"
#include "content/public/browser/permission_controller.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/url_constants.h"
#include "third_party/blink/public/common/permissions/permission_utils.h"

namespace performance_manager {

namespace policies {

namespace {

// Pointer to the instance of itself.
BackgroundTabLoadingPolicy* g_background_tab_loading_policy =;

const char kDescriberName[] =;

}  // namespace

// static
constexpr uint32_t BackgroundTabLoadingPolicy::kMinTabsToLoad;
constexpr uint32_t BackgroundTabLoadingPolicy::kMaxTabsToLoad;
constexpr uint32_t BackgroundTabLoadingPolicy::kDesiredAmountOfFreeMemoryMb;
constexpr base::TimeDelta
    BackgroundTabLoadingPolicy::kMaxTimeSinceLastUseToLoad;
constexpr uint32_t BackgroundTabLoadingPolicy::kMinSimultaneousTabLoads;
constexpr uint32_t BackgroundTabLoadingPolicy::kMaxSimultaneousTabLoads;
constexpr uint32_t BackgroundTabLoadingPolicy::kCoresPerSimultaneousTabLoad;

BackgroundTabLoadingPolicy::PageNodeData::PageNodeData(
    base::WeakPtr<PageNode> page_node,
    GURL main_frame_url,
    blink::mojom::PermissionStatus notification_permission_status)
    :{}

BackgroundTabLoadingPolicy::PageNodeData::PageNodeData(PageNodeData&& other) =
    default;
BackgroundTabLoadingPolicy::PageNodeData&
BackgroundTabLoadingPolicy::PageNodeData::operator=(PageNodeData&& other) =
    default;
BackgroundTabLoadingPolicy::PageNodeData::PageNodeData(
    const PageNodeData& other) = default;
BackgroundTabLoadingPolicy::PageNodeData&
BackgroundTabLoadingPolicy::PageNodeData::operator=(const PageNodeData& other) =
    default;
BackgroundTabLoadingPolicy::PageNodeData::~PageNodeData() = default;

void ScheduleLoadForRestoredTabs(
    std::vector<content::WebContents*> web_contents_vector) {}

BackgroundTabLoadingPolicy::BackgroundTabLoadingPolicy(
    base::RepeatingClosure all_restored_tabs_loaded_callback)
    :{}

BackgroundTabLoadingPolicy::~BackgroundTabLoadingPolicy() {}

void BackgroundTabLoadingPolicy::OnPassedToGraph(Graph* graph) {}

void BackgroundTabLoadingPolicy::OnTakenFromGraph(Graph* graph) {}

void BackgroundTabLoadingPolicy::OnLoadingStateChanged(
    const PageNode* page_node,
    PageNode::LoadingState previous_state) {}

void BackgroundTabLoadingPolicy::OnBeforePageNodeRemoved(
    const PageNode* page_node) {}

void BackgroundTabLoadingPolicy::ScheduleLoadForRestoredTabs(
    std::vector<BackgroundTabLoadingPolicy::PageNodeData>
        page_node_data_vector) {}

void BackgroundTabLoadingPolicy::SetMockLoaderForTesting(
    std::unique_ptr<mechanism::PageLoader> loader) {}

void BackgroundTabLoadingPolicy::SetMaxSimultaneousLoadsForTesting(
    size_t loading_slots) {}

void BackgroundTabLoadingPolicy::SetFreeMemoryForTesting(
    size_t free_memory_mb) {}

void BackgroundTabLoadingPolicy::ResetPolicyForTesting() {}

BackgroundTabLoadingPolicy* BackgroundTabLoadingPolicy::GetInstance() {}

BackgroundTabLoadingPolicy::PageNodeToLoadData::PageNodeToLoadData(
    PageNode* page_node)
    :{}

BackgroundTabLoadingPolicy::PageNodeToLoadData::~PageNodeToLoadData() = default;

struct BackgroundTabLoadingPolicy::ScoredTabComparator {};

base::Value::Dict BackgroundTabLoadingPolicy::DescribePageNodeData(
    const PageNode* node) const {}

base::Value::Dict BackgroundTabLoadingPolicy::DescribeSystemNodeData(
    const SystemNode* node) const {}

bool BackgroundTabLoadingPolicy::ShouldLoad(const PageNode* page_node) {}

void BackgroundTabLoadingPolicy::OnUsedInBackgroundAvailable(
    base::WeakPtr<PageNode> page_node) {}

void BackgroundTabLoadingPolicy::StopLoadingTabs() {}

void BackgroundTabLoadingPolicy::OnMemoryPressure(
    base::MemoryPressureListener::MemoryPressureLevel new_level) {}

SiteDataReader* BackgroundTabLoadingPolicy::GetSiteDataReader(
    const PageNode* page_node) const {}

void BackgroundTabLoadingPolicy::ScoreTab(
    PageNodeToLoadData* page_node_to_load_data) {}

void BackgroundTabLoadingPolicy::SetUsedInBackgroundAsync(
    PageNodeToLoadData* page_node_to_load_data) {}

void BackgroundTabLoadingPolicy::DispatchNotifyAllTabsScoredIfNeeded() {}

void BackgroundTabLoadingPolicy::NotifyAllTabsScored() {}

void BackgroundTabLoadingPolicy::InitiateLoad(const PageNode* page_node) {}

void BackgroundTabLoadingPolicy::RemovePageNode(const PageNode* page_node) {}

void BackgroundTabLoadingPolicy::MaybeLoadSomeTabs() {}

size_t BackgroundTabLoadingPolicy::GetMaxNewTabLoads() const {}

void BackgroundTabLoadingPolicy::LoadNextTab() {}

size_t BackgroundTabLoadingPolicy::GetFreePhysicalMemoryMib() const {}

bool BackgroundTabLoadingPolicy::ErasePageNodeToLoadData(
    const PageNode* page_node) {}

BackgroundTabLoadingPolicy::PageNodeToLoadData*
BackgroundTabLoadingPolicy::FindPageNodeToLoadData(const PageNode* page_node) {}

bool BackgroundTabLoadingPolicy::HasRestoredTabsToLoad() const {}

void BackgroundTabLoadingPolicy::UpdateHasRestoredTabsToLoad() {}

}  // namespace policies

}  // namespace performance_manager