#include "components/segmentation_platform/embedder/input_delegate/tab_rank_dispatcher.h"
#include <memory>
#include <queue>
#include <vector>
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/time/time.h"
#include "components/segmentation_platform/embedder/tab_fetcher.h"
#include "components/segmentation_platform/public/input_context.h"
#include "components/segmentation_platform/public/prediction_options.h"
#include "components/segmentation_platform/public/result.h"
#include "components/segmentation_platform/public/segmentation_platform_service.h"
#include "components/segmentation_platform/public/types/processed_value.h"
namespace segmentation_platform {
namespace {
constexpr uint32_t kTabCandidateLimit = …;
void RecordDelayFromStartupToFirstSyncUpdate(
base::TimeDelta sync_delay_duration) { … }
void RecordDelayFromStartupToSyncUpdate(base::TimeDelta sync_delay_duration) { … }
void RecordDelayFromTabLoadToSyncUpdate(base::TimeDelta sync_delay_duration) { … }
void RecordTabCountAtStartup(long cross_device_tab_count) { … }
void RecordTabCountFromStartupToFirstSyncUpdate(long cross_device_tab_count) { … }
void RecordRecent1HourTabCountAtFirstSyncUpdate(long cross_device_tab_count) { … }
void RecordRecent1DayTabCountAtFirstSyncUpdate(long cross_device_tab_count) { … }
void RecordTabCountAtSyncUpdate(long cross_device_tab_count) { … }
}
TabRankDispatcher::TabRankDispatcher(
SegmentationPlatformService* segmentation_service,
sync_sessions::SessionSyncService* session_sync_service,
std::unique_ptr<TabFetcher> tab_fetcher)
: … { … }
TabRankDispatcher::~TabRankDispatcher() = default;
void TabRankDispatcher::GetTopRankedTabs(const std::string& segmentation_key,
const TabFilter& tab_filter,
RankedTabsCallback callback) { … }
void TabRankDispatcher::GetNextResult(const std::string& segmentation_key,
std::queue<RankedTab> candidate_tabs,
std::multiset<RankedTab> results,
RankedTabsCallback callback) { … }
void TabRankDispatcher::OnGetResult(const std::string& segmentation_key,
std::queue<RankedTab> candidate_tabs,
std::multiset<RankedTab> results,
RankedTabsCallback callback,
RankedTab current_tab,
const AnnotatedNumericResult& result) { … }
void TabRankDispatcher::SubscribeToForeignSessionsChanged() { … }
void TabRankDispatcher::OnForeignSessionUpdated() { … }
}