mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
The size of the LTO build of the engine with the dylib compressed is as follows: ```sh $ du -k libFlutter* 5236 libFlutter.dylib.tar.gz 4324 libFlutterSlimpeller.dylib.tar.gz ``` Sizes are in KiB. This represents a binary size reduction of 17.41% of the compressed artifacts. The compression ratios will likely differ based on the compression scheme. Uncompressed, the sizes are: ```sh $ du -k libFlutter* 16920 libFlutter.dylib 14044 libFlutterSlimpeller.dylib ``` This represents a binary size reduction of 16.99% which is in the same ballpark. The really mucky bit was backing out the raster cache and persistent cache. I want to clean that up in a later patch so that those TUs are part of a separate submodule. Opting out of Impeller will lead to a fatal log at startup saying the opt-out is disallowed. Fixes https://github.com/flutter/flutter/issues/126606
33 lines
1008 B
C++
33 lines
1008 B
C++
// Copyright 2013 The Flutter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#if !SLIMPELLER
|
|
|
|
#include "flutter/flow/raster_cache_key.h"
|
|
#include <optional>
|
|
#include "flutter/flow/layers/container_layer.h"
|
|
#include "flutter/flow/layers/display_list_layer.h"
|
|
#include "flutter/flow/layers/layer.h"
|
|
|
|
namespace flutter {
|
|
|
|
std::optional<std::vector<RasterCacheKeyID>> RasterCacheKeyID::LayerChildrenIds(
|
|
const Layer* layer) {
|
|
FML_DCHECK(layer->as_container_layer());
|
|
auto& children_layers = layer->as_container_layer()->layers();
|
|
auto children_count = children_layers.size();
|
|
if (children_count == 0) {
|
|
return std::nullopt;
|
|
}
|
|
std::vector<RasterCacheKeyID> ids;
|
|
std::transform(
|
|
children_layers.begin(), children_layers.end(), std::back_inserter(ids),
|
|
[](auto& layer) -> RasterCacheKeyID { return layer->caching_key_id(); });
|
|
return ids;
|
|
}
|
|
|
|
} // namespace flutter
|
|
|
|
#endif // !SLIMPELLER
|