// 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_FEED_CORE_V2_STREAM_MODEL_FEATURE_TREE_H_ #define COMPONENTS_FEED_CORE_V2_STREAM_MODEL_FEATURE_TREE_H_ #include <map> #include <string> #include <utility> #include <vector> #include "base/memory/raw_ptr.h" #include "base/types/id_type.h" #include "components/feed/core/proto/v2/store.pb.h" #include "components/feed/core/v2/proto_util.h" #include "components/feed/core/v2/types.h" namespace feed { namespace stream_model { // Uniquely identifies a feedwire::ContentId. Provided by |ContentMap|. ContentTag; ContentRevision; // Owns instances of feedstore::Content pointed to by the feature tree, and // maps ContentId into ContentTag. class ContentMap { … }; // A node in FeatureTree. struct StreamNode { … }; // The feature tree which underlies StreamModel. // This tree is different than most, the rules are as follows: // * A node may or may not have a parent, so this is more of a forest than a // tree. // * When nodes are removed, their set of children are remembered. If the node // is added again, it retains its old children. // * A node can be added multiple times, but subsequent adds will not change // the node's parent. // * There is only one 'stream root' acknowledged, even though there can be many // roots. The stream root is the last root node added of type STREAM. The // stream root identifies the tree whose nodes are used to compute // |GetVisibleContent()|. // * A tree can be constructed with a base tree. This copies features from base, // but refers to content stored in base by reference. class FeatureTree { … }; } // namespace stream_model } // namespace feed #endif // COMPONENTS_FEED_CORE_V2_STREAM_MODEL_FEATURE_TREE_H_