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
Reland "Share engine layers with the framework" (#6412) #6468
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
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
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
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
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,26 @@ | ||
| // Copyright 2018 The Chromium 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/lib/ui/painting/engine_layer.h" | ||
|
|
||
| #include "flutter/flow/layers/container_layer.h" | ||
|
|
||
| #include "third_party/tonic/converter/dart_converter.h" | ||
| #include "third_party/tonic/dart_args.h" | ||
| #include "third_party/tonic/dart_binding_macros.h" | ||
| #include "third_party/tonic/dart_library_natives.h" | ||
|
|
||
| using tonic::ToDart; | ||
|
|
||
| namespace blink { | ||
|
|
||
| EngineLayer::~EngineLayer() = default; | ||
|
|
||
| IMPLEMENT_WRAPPERTYPEINFO(ui, EngineLayer); | ||
|
|
||
| #define FOR_EACH_BINDING(V) // nothing to bind | ||
|
|
||
| DART_BIND_ALL(EngineLayer, FOR_EACH_BINDING) | ||
|
|
||
| } // namespace blink |
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,44 @@ | ||
| // Copyright 2018 The Chromium 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_LIB_UI_PAINTING_ENGINE_LAYER_H_ | ||
| #define FLUTTER_LIB_UI_PAINTING_ENGINE_LAYER_H_ | ||
|
|
||
| #include "flutter/lib/ui/dart_wrapper.h" | ||
|
|
||
| #include "flutter/flow/layers/layer.h" | ||
|
|
||
| namespace tonic { | ||
| class DartLibraryNatives; | ||
| } // namespace tonic | ||
|
|
||
| namespace blink { | ||
|
|
||
| class EngineLayer; | ||
|
|
||
| class EngineLayer : public RefCountedDartWrappable<EngineLayer> { | ||
| DEFINE_WRAPPERTYPEINFO(); | ||
|
|
||
| public: | ||
| ~EngineLayer() override; | ||
| static fml::RefPtr<EngineLayer> MakeRetained( | ||
| std::shared_ptr<flow::ContainerLayer> layer) { | ||
| return fml::MakeRefCounted<EngineLayer>(layer); | ||
| } | ||
|
|
||
| static void RegisterNatives(tonic::DartLibraryNatives* natives); | ||
|
|
||
| std::shared_ptr<flow::ContainerLayer> Layer() const { return layer_; } | ||
|
|
||
| private: | ||
| explicit EngineLayer(std::shared_ptr<flow::ContainerLayer> layer) | ||
| : layer_(layer) {} | ||
| std::shared_ptr<flow::ContainerLayer> layer_; | ||
|
|
||
| FML_FRIEND_MAKE_REF_COUNTED(EngineLayer); | ||
| }; | ||
|
|
||
| } // namespace blink | ||
|
|
||
| #endif // FLUTTER_LIB_UI_PAINTING_ENGINE_LAYER_H_ |
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.
Just curious about how these pragmas work. Can we decorate the class with the same to indicate that all methods of the same are potential entrypoints?
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.
I don't know since I just followed what @alexmarkov suggested. Alex might know the answer?
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.
Entry point annotation on class means that its instances can be created from non-Dart code. It does not mark all members as entry points. If C++ code calls particular constructor, then that particular constructor should be marked with pragma.
Also, it makes sense to annotate only those members which are used from non-Dart code, as annotating all members may just increase the size of snapshot and make global analysis less precise.
More about syntax and meaning of entry point pragmas: https://github.com/dart-lang/sdk/blob/master/runtime/vm/compiler/aot/entry_points_pragma.md