#include "cc/mojo_embedder/viz_layer_context.h"
#include <cstdint>
#include <unordered_set>
#include <utility>
#include <vector>
#include "base/containers/span.h"
#include "base/numerics/safe_conversions.h"
#include "cc/layers/layer_impl.h"
#include "cc/trees/layer_tree_impl.h"
#include "cc/trees/property_tree.h"
#include "services/viz/public/mojom/compositing/layer.mojom.h"
#include "services/viz/public/mojom/compositing/layer_context.mojom.h"
namespace cc::mojo_embedder {
namespace {
void ComputePropertyTreeNodeUpdate(
const TransformNode* old_node,
const TransformNode& new_node,
std::vector<viz::mojom::TransformNodePtr>& container) { … }
void ComputePropertyTreeNodeUpdate(
const ClipNode* old_node,
const ClipNode& new_node,
std::vector<viz::mojom::ClipNodePtr>& container) { … }
void ComputePropertyTreeNodeUpdate(
const EffectNode* old_node,
const EffectNode& new_node,
std::vector<viz::mojom::EffectNodePtr>& container) { … }
void ComputePropertyTreeNodeUpdate(
const ScrollNode* old_node,
const ScrollNode& new_node,
std::vector<viz::mojom::ScrollNodePtr>& container) { … }
template <typename TreeType, typename ContainerType>
void ComputePropertyTreeUpdate(const TreeType& old_tree,
const TreeType& new_tree,
ContainerType& updates,
uint32_t& new_num_nodes) { … }
std::vector<viz::mojom::StickyPositionNodeDataPtr> SerializeStickyPositionData(
const std::vector<StickyPositionNodeData>& entries) { … }
std::vector<viz::mojom::AnchorPositionScrollDataPtr>
SerializeAnchorPositionScrollData(
const std::vector<AnchorPositionScrollData>& entries) { … }
viz::mojom::TransformTreeUpdatePtr ComputeTransformTreePropertiesUpdate(
const TransformTree& old_tree,
const TransformTree& new_tree) { … }
viz::mojom::TileResourcePtr SerializeTileResource(
const Tile& tile,
viz::ClientResourceProvider& resource_provider,
viz::RasterContextProvider& context_provider) { … }
viz::mojom::TilePtr SerializeTile(
const Tile& tile,
viz::ClientResourceProvider& resource_provider,
viz::RasterContextProvider& context_provider) { … }
viz::mojom::TilingPtr SerializeTiling(
PictureLayerImpl& layer,
const PictureLayerTiling& tiling,
base::span<const Tile*> tiles,
viz::ClientResourceProvider& resource_provider,
viz::RasterContextProvider& context_provider) { … }
void SerializePictureLayerTileUpdates(
PictureLayerImpl& layer,
viz::ClientResourceProvider& resource_provider,
viz::RasterContextProvider& context_provider,
std::vector<viz::mojom::TilingPtr>& tilings) { … }
void SerializeLayer(LayerImpl& layer,
viz::ClientResourceProvider& resource_provider,
viz::RasterContextProvider& context_provider,
viz::mojom::LayerTreeUpdate& update) { … }
}
VizLayerContext::VizLayerContext(viz::mojom::CompositorFrameSink& frame_sink,
LayerTreeHostImpl& host_impl)
: … { … }
VizLayerContext::~VizLayerContext() = default;
void VizLayerContext::SetVisible(bool visible) { … }
void VizLayerContext::UpdateDisplayTreeFrom(
LayerTreeImpl& tree,
viz::ClientResourceProvider& resource_provider,
viz::RasterContextProvider& context_provider) { … }
void VizLayerContext::UpdateDisplayTile(
PictureLayerImpl& layer,
const Tile& tile,
viz::ClientResourceProvider& resource_provider,
viz::RasterContextProvider& context_provider) { … }
void VizLayerContext::OnRequestCommitForFrame(const viz::BeginFrameArgs& args) { … }
}