#include "chrome/browser/sessions/tab_loader.h"
#include <algorithm>
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/memory/memory_pressure_monitor.h"
#include "base/memory/raw_ptr.h"
#include "base/no_destructor.h"
#include "base/not_fatal_until.h"
#include "base/system/sys_info.h"
#include "base/time/default_tick_clock.h"
#include "base/trace_event/memory_pressure_level_proto.h"
#include "base/trace_event/named_trigger.h"
#include "base/trace_event/typed_macros.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/sessions/session_restore.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "components/favicon/content/content_favicon_driver.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_features.h"
WebContents;
TabLoadTracker;
namespace {
void BackgroundTracingTrigger() { … }
const base::TickClock* GetDefaultTickClock() { … }
struct ScoredTabComparator { … };
size_t g_max_loaded_tab_count_for_testing = …;
base::RepeatingCallback<void(TabLoader*)>* g_construction_callback = …;
bool IsBrowserClosing(Browser* browser) { … }
}
class TabLoader::ReentrancyHelper { … };
TabLoader* TabLoader::shared_tab_loader_ = …;
void TabLoader::RestoreTabs(const std::vector<RestoredTab>& tabs,
const base::TimeTicks& restore_started) { … }
void TabLoader::SetMaxLoadedTabCountForTesting(size_t value) { … }
void TabLoader::SetConstructionCallbackForTesting(
base::RepeatingCallback<void(TabLoader*)>* callback) { … }
void TabLoader::SetMaxSimultaneousLoadsForTesting(size_t loading_slots) { … }
void TabLoader::SetTickClockForTesting(base::TickClock* tick_clock) { … }
void TabLoader::MaybeLoadSomeTabsForTesting() { … }
void TabLoader::SetTabLoadingEnabledCallbackForTesting(
base::RepeatingCallback<void(bool)>* callback) { … }
bool TabLoader::IsLoadingEnabled() const { … }
void TabLoader::OnIsLoadingEnabledChanged() { … }
void TabLoader::SetAllTabsScored(bool all_tabs_scored) { … }
TabLoader::TabLoader()
: … { … }
TabLoader::~TabLoader() { … }
void TabLoader::SetTabLoadingEnabled(bool loading_enabled) { … }
void TabLoader::NotifyTabScoreChanged(content::WebContents* contents,
float score) { … }
void TabLoader::StartLoading(const std::vector<RestoredTab>& tabs) { … }
void TabLoader::OnLoadingStateChange(WebContents* contents,
LoadingState old_loading_state,
LoadingState new_loading_state) { … }
void TabLoader::OnStopTracking(WebContents* web_contents,
LoadingState loading_state) { … }
void TabLoader::OnMemoryPressure(
base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) { … }
bool TabLoader::ShouldStopLoadingTabs() const { … }
size_t TabLoader::GetMaxNewTabLoads() const { … }
void TabLoader::AddTab(WebContents* contents) { … }
void TabLoader::RemoveTab(WebContents* contents) { … }
void TabLoader::MarkTabAsLoadInitiated(WebContents* contents) { … }
void TabLoader::MarkTabAsLoading(WebContents* contents) { … }
void TabLoader::MarkTabAsDeferred(content::WebContents* contents) { … }
void TabLoader::MaybeLoadSomeTabs() { … }
void TabLoader::ForceLoadTimerFired() { … }
void TabLoader::StopLoadingTabs() { … }
content::WebContents* TabLoader::GetNextTabToLoad() { … }
void TabLoader::LoadNextTab(bool due_to_timeout) { … }
base::TimeDelta TabLoader::GetLoadTimeoutPeriod() const { … }
void TabLoader::StartTimerIfNeeded() { … }
TabLoader::TabVector::iterator TabLoader::FindTabToLoad(
content::WebContents* contents) { … }
TabLoader::TabVector::const_iterator TabLoader::FindTabToLoad(
content::WebContents* contents) const { … }
void TabLoader::MoveToSortedPosition(TabVector::iterator it) { … }
size_t TabLoader::MaxSimultaneousLoads() const { … }