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#if !SLIMPELLER
6
8#include <optional>
12
13namespace flutter {
14
15std::optional<std::vector<RasterCacheKeyID>> RasterCacheKeyID::LayerChildrenIds(
16 const Layer* layer) {
18 auto& children_layers = layer->as_container_layer()->layers();
19 auto children_count = children_layers.size();
20 if (children_count == 0) {
21 return std::nullopt;
22 }
23 std::vector<RasterCacheKeyID> ids;
24 std::transform(
25 children_layers.begin(), children_layers.end(), std::back_inserter(ids),
26 [](auto& layer) -> RasterCacheKeyID { return layer->caching_key_id(); });
27 return ids;
28}
29
30} // namespace flutter
31
32#endif // !SLIMPELLER
const std::vector< std::shared_ptr< Layer > > & layers() const
virtual const ContainerLayer * as_container_layer() const
Definition layer.h:244
static std::optional< std::vector< RasterCacheKeyID > > LayerChildrenIds(const Layer *layer)
#define FML_DCHECK(condition)
Definition logging.h:122