#include "components/feed/core/v2/surface_updater.h"
#include <tuple>
#include <utility>
#include "base/check.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
#include "components/feed/core/proto/v2/ui.pb.h"
#include "components/feed/core/proto/v2/wire/reliability_logging_enums.pb.h"
#include "components/feed/core/proto/v2/xsurface.pb.h"
#include "components/feed/core/v2/enums.h"
#include "components/feed/core/v2/feed_stream.h"
#include "components/feed/core/v2/feed_stream_surface.h"
#include "components/feed/core/v2/launch_reliability_logger.h"
#include "components/feed/core/v2/metrics_reporter.h"
#include "components/feed/core/v2/stream_surface_set.h"
#include "components/feed/core/v2/types.h"
namespace feed {
namespace {
DrawState;
StreamUpdateType;
const char* GetZeroStateSliceId(feedui::ZeroStateSlice::Type type) { … }
void AddSharedState(const StreamModel& model,
const std::string& shared_state_id,
feedui::StreamUpdate* stream_update) { … }
void AddSliceUpdate(const StreamModel& model,
ContentRevision content_revision,
bool is_content_new,
feedui::StreamUpdate* stream_update) { … }
void AddLoadingSpinner(bool is_initial_load,
int load_more_indicator_id,
feedui::StreamUpdate* update) { … }
struct StreamUpdateAndType { … };
StreamUpdateAndType MakeStreamUpdate(
const std::vector<std::string>& updated_shared_state_ids,
const base::flat_set<ContentRevision>& already_sent_content,
const StreamModel* model,
const DrawState& state,
int load_more_indicator_id) { … }
StreamUpdateAndType GetUpdateForNewSurface(const DrawState& state,
const StreamModel* model) { … }
base::flat_set<ContentRevision> GetContentSet(const StreamModel* model) { … }
feedui::ZeroStateSlice::Type GetZeroStateType(LoadStreamStatus status) { … }
}
bool SurfaceUpdater::DrawState::operator==(const DrawState& rhs) const { … }
SurfaceUpdater::SurfaceUpdater(
MetricsReporter* metrics_reporter,
XsurfaceDatastoreDataReader* global_datastore_slice,
StreamSurfaceSet* surfaces)
: … { … }
SurfaceUpdater::~SurfaceUpdater() { … }
void SurfaceUpdater::SetModel(StreamModel* model) { … }
void SurfaceUpdater::OnUiUpdate(const StreamModel::UiUpdate& update) { … }
void SurfaceUpdater::SurfaceAdded(
SurfaceId surface_id,
SurfaceRenderer* renderer,
feedwire::DiscoverLaunchResult loading_not_allowed_reason) { … }
void SurfaceUpdater::SurfaceRemoved(SurfaceId surface_id) { … }
void SurfaceUpdater::DatastoreEntryUpdated(XsurfaceDatastoreDataReader*,
const std::string& key) { … }
void SurfaceUpdater::DatastoreEntryRemoved(XsurfaceDatastoreDataReader*,
const std::string& key) { … }
void SurfaceUpdater::LoadStreamStarted(bool manual_refreshing) { … }
void SurfaceUpdater::LoadStreamComplete(
bool success,
LoadStreamStatus load_stream_status,
feedwire::DiscoverLaunchResult launch_result) { … }
int SurfaceUpdater::GetSliceIndexFromSliceId(const std::string& slice_id) { … }
void SurfaceUpdater::SetLoadingMore(bool is_loading) { … }
DrawState SurfaceUpdater::GetState() const { … }
bool SurfaceUpdater::ShouldSendStreamUpdate() const { … }
void SurfaceUpdater::SendStreamUpdateIfNeeded() { … }
void SurfaceUpdater::SendStreamUpdate(
const std::vector<std::string>& updated_shared_state_ids) { … }
void SurfaceUpdater::SendUpdateToSurface(SurfaceId surface_id,
SurfaceRenderer* renderer,
const feedui::StreamUpdate& update) { … }
void SurfaceUpdater::SetOfflinePageAvailability(const std::string& badge_id,
bool available_offline) { … }
}