This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Defer decisions about RasterCache actions until after Preroll is complete #31892
Merged
fluttergithubbot
merged 37 commits into
flutter:main
from
JsouLiang:Collection-Need-RasterCache-Layer-In-Preroll
Jun 30, 2022
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
9f44aad
Collection Need RasterCache Layer in Preroll
JsouLiang bb6a4cc
Collection Need RasterCache DisplayListLayer In Preroll
JsouLiang 51ae333
Collection Need RasterCache DisplayListLayer In Preroll
JsouLiang bb86e3a
Differentiate RasterCacheableEntry Layer DisplayList SkPicture
JsouLiang 98b4ad6
Collection Raster Cacheable OpacityLayer in Preroll
JsouLiang 2a0fbc3
Add PictureLayer RasterCache
JsouLiang 9a71e09
Use Cacheable Object to entry the layer
JsouLiang 0f60777
Fix some failed cases; Add new test case for collect RasterCacheable …
JsouLiang d53733e
Fix RasterCacheDisabledWithPlatformViews test error
JsouLiang 4600cd6
ImageFilterLayer NeedCache check filter is nullptr
JsouLiang 7626d11
Fix the PrerollContext size is different in windows platform
JsouLiang d88aff2
Change the logic of raster cache entry
JsouLiang 45b28cf
Change the Cacheable interface capacity
JsouLiang 57a8d16
Update the LayerTree::TryToRasterCache logic; Change some comments
JsouLiang e4eb2a0
fix conflict
JsouLiang 7e5af26
Add RasterCache test in Container_layer_unittest file
JsouLiang 879ee10
If parent cached success, we will try to remove the children cache
JsouLiang 2c038e9
Move Prepare, Touch, Draw from RasterCache to CacheableItem
JsouLiang 829e9f4
fix shell unittest test failed
JsouLiang 91cf4e9
Optimize structure
JsouLiang ba5694e
Change RasterCacheItem struct and fix some test cases
JsouLiang 45448d4
Fix test cases
JsouLiang dc089ad
Remove the RasterCacheResult survival count
JsouLiang 2f1eb2f
fix naming issues
JsouLiang 473288b
Change the RasterCache of ClipLayer
JsouLiang a80a037
Fix some comments
JsouLiang fd82489
Change the licenses
JsouLiang d3883c6
fix some comments
JsouLiang 3e1ed6c
Rebase master
JsouLiang a25e920
Remove redundant logic
JsouLiang fd3bc8e
resolve conflicting files
JsouLiang cdc123d
Fix comments
JsouLiang d8d373a
Update licenses
JsouLiang 9e0e52b
fix the display_list_raster_item set cache entry logic
JsouLiang 9b68847
ImageFilterLayer Reset cache_children; Fix some comments
JsouLiang 7c7fc4c
LayerRCI use GetPaintBoundsFromLayer to paint cache
JsouLiang 91f7278
Change lambda capture variable; fix nits
JsouLiang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| // 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/flow/layers/cacheable_layer.h" | ||
| #include "flutter/flow/raster_cache.h" | ||
| #include "flutter/flow/raster_cache_item.h" | ||
|
|
||
| namespace flutter { | ||
|
|
||
| AutoCache::AutoCache(RasterCacheItem* raster_cache_item, | ||
| PrerollContext* context, | ||
| const SkMatrix& matrix) | ||
| : raster_cache_item_(raster_cache_item), | ||
| context_(context), | ||
| matrix_(matrix) { | ||
| if (IsCacheEnabled()) { | ||
| raster_cache_item->PrerollSetup(context, matrix); | ||
| } | ||
| } | ||
|
|
||
| bool AutoCache::IsCacheEnabled() { | ||
| return raster_cache_item_ && context_ && context_->raster_cache; | ||
| } | ||
|
|
||
| AutoCache::~AutoCache() { | ||
| if (IsCacheEnabled()) { | ||
| raster_cache_item_->PrerollFinalize(context_, matrix_); | ||
| } | ||
| } | ||
|
|
||
| CacheableContainerLayer::CacheableContainerLayer(int layer_cached_threshold, | ||
| bool can_cache_children) { | ||
| layer_raster_cache_item_ = LayerRasterCacheItem::Make( | ||
| this, layer_cached_threshold, can_cache_children); | ||
| } | ||
|
|
||
| } // namespace flutter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| // 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. | ||
|
|
||
| #ifndef FLUTTER_FLOW_LAYERS_CACHEABLE_LAYER_H_ | ||
| #define FLUTTER_FLOW_LAYERS_CACHEABLE_LAYER_H_ | ||
|
|
||
| #include <memory> | ||
|
|
||
| #include "flutter/flow/layers/container_layer.h" | ||
| #include "flutter/flow/layers/display_list_raster_cache_item.h" | ||
| #include "flutter/flow/layers/layer_raster_cache_item.h" | ||
|
|
||
| namespace flutter { | ||
|
|
||
| class AutoCache { | ||
| public: | ||
| AutoCache(RasterCacheItem* raster_cache_item, | ||
| PrerollContext* context, | ||
| const SkMatrix& matrix); | ||
|
|
||
| void ShouldNotBeCached() { raster_cache_item_ = nullptr; } | ||
|
|
||
| ~AutoCache(); | ||
|
|
||
| private: | ||
| inline bool IsCacheEnabled(); | ||
| RasterCacheItem* raster_cache_item_ = nullptr; | ||
| PrerollContext* context_ = nullptr; | ||
| const SkMatrix& matrix_; | ||
| }; | ||
|
|
||
| class CacheableContainerLayer : public ContainerLayer { | ||
| public: | ||
| explicit CacheableContainerLayer( | ||
| int layer_cached_threshold = | ||
| RasterCacheUtil::kMinimumRendersBeforeCachingFilterLayer, | ||
| bool can_cache_children = false); | ||
|
|
||
| const LayerRasterCacheItem* raster_cache_item() const { | ||
| return layer_raster_cache_item_.get(); | ||
| } | ||
|
|
||
| protected: | ||
| std::unique_ptr<LayerRasterCacheItem> layer_raster_cache_item_; | ||
| }; | ||
|
|
||
| } // namespace flutter | ||
|
|
||
| #endif // FLUTTER_FLOW_LAYERS_CACHEABLE_LAYER_H_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here and elsewhere: while you're here, consider fixing the C-style casts to C++ style, e.g.
static_cast<size_t>(0)below this line.