Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
raster_cache_key.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "flutter/flow/raster_cache_key.h"
6#include <optional>
7#include "flutter/flow/layers/container_layer.h"
8#include "flutter/flow/layers/display_list_layer.h"
9#include "flutter/flow/layers/layer.h"
10namespace flutter {
11
12//
13
14std::optional<std::vector<RasterCacheKeyID>> RasterCacheKeyID::LayerChildrenIds(
15 const Layer* layer) {
17 auto& children_layers = layer->as_container_layer()->layers();
18 auto children_count = children_layers.size();
19 if (children_count == 0) {
20 return std::nullopt;
21 }
22 std::vector<RasterCacheKeyID> ids;
23 std::transform(
24 children_layers.begin(), children_layers.end(), std::back_inserter(ids),
25 [](auto& layer) -> RasterCacheKeyID { return layer->caching_key_id(); });
26 return ids;
27}
28
29} // namespace flutter
const std::vector< std::shared_ptr< Layer > > & layers() const
virtual const ContainerLayer * as_container_layer() const
Definition layer.h:255
static std::optional< std::vector< RasterCacheKeyID > > LayerChildrenIds(const Layer *layer)
#define FML_DCHECK(condition)
Definition logging.h:103