flutter_flutter/engine/src/flutter/shell/common/snapshot_controller.cc
Chinmay Garde f20b17a2ae [Impeller] Prepare a SkiaGPU-less iOS build. (flutter/engine#52748)
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
2024-05-13 21:43:47 +00:00

36 lines
1.1 KiB
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.
#include "flutter/shell/common/snapshot_controller.h"
#include "flutter/shell/common/snapshot_controller_skia.h"
#if IMPELLER_SUPPORTS_RENDERING
#include "flutter/shell/common/snapshot_controller_impeller.h"
#endif // IMPELLER_SUPPORTS_RENDERING
namespace flutter {
std::unique_ptr<SnapshotController> SnapshotController::Make(
const Delegate& delegate,
const Settings& settings) {
#if IMPELLER_SUPPORTS_RENDERING
if (settings.enable_impeller) {
return std::make_unique<SnapshotControllerImpeller>(delegate);
}
#endif // IMPELLER_SUPPORTS_RENDERING
#if !SLIMPELLER
return std::make_unique<SnapshotControllerSkia>(delegate);
#else // !SLIMPELLER
FML_LOG(FATAL)
<< "Cannot create a Skia snapshot controller in an Impeller build.";
return nullptr;
#endif // !SLIMPELLER
}
SnapshotController::SnapshotController(const Delegate& delegate)
: delegate_(delegate) {}
} // namespace flutter