Flutter Engine
The Flutter Engine
shell_test_external_view_embedder.h
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#ifndef FLUTTER_SHELL_COMMON_SHELL_TEST_EXTERNAL_VIEW_EMBEDDER_H_
6#define FLUTTER_SHELL_COMMON_SHELL_TEST_EXTERNAL_VIEW_EMBEDDER_H_
7
8#include "flutter/flow/embedded_views.h"
9#include "flutter/fml/raster_thread_merger.h"
10
11namespace flutter {
12
13//------------------------------------------------------------------------------
14/// @brief The external view embedder used by |ShellTestPlatformViewGL|
15///
17 public:
20
21 ShellTestExternalViewEmbedder(const EndFrameCallBack& end_frame_call_back,
22 PostPrerollResult post_preroll_result,
23 bool support_thread_merging);
24
26
27 // Updates the post preroll result so the |PostPrerollAction| after always
28 // returns the new `post_preroll_result`.
29 void UpdatePostPrerollResult(PostPrerollResult post_preroll_result);
30
31 // Gets the number of times the SubmitFlutterView method has been called in
32 // the external view embedder.
34
35 // Returns the size of last submitted frame surface.
37
38 // Returns the mutators stack for the given platform view.
39 MutatorsStack GetStack(int64_t);
40
41 // Returns the list of visited platform views.
42 std::vector<int64_t> GetVisitedPlatformViews();
43
44 private:
45 // |ExternalViewEmbedder|
46 void CancelFrame() override;
47
48 // |ExternalViewEmbedder|
49 void BeginFrame(GrDirectContext* context,
51 raster_thread_merger) override;
52
53 // |ExternalViewEmbedder|
54 void PrepareFlutterView(SkISize frame_size,
55 double device_pixel_ratio) override;
56
57 // |ExternalViewEmbedder|
58 void PrerollCompositeEmbeddedView(
59 int64_t view_id,
60 std::unique_ptr<EmbeddedViewParams> params) override;
61
62 // |ExternalViewEmbedder|
63 PostPrerollResult PostPrerollAction(
64 const fml::RefPtr<fml::RasterThreadMerger>& raster_thread_merger)
65 override;
66
67 // |ExternalViewEmbedder|
68 DlCanvas* CompositeEmbeddedView(int64_t view_id) override;
69
70 // |ExternalViewEmbedder|
71 void PushVisitedPlatformView(int64_t view_id) override;
72
73 // |ExternalViewEmbedder|
74 void PushFilterToVisitedPlatformViews(
75 const std::shared_ptr<const DlImageFilter>& filter,
76 const SkRect& filter_rect) override;
77
78 // |ExternalViewEmbedder|
79 void SubmitFlutterView(
80 int64_t flutter_view_id,
81 GrDirectContext* context,
82 const std::shared_ptr<impeller::AiksContext>& aiks_context,
83 std::unique_ptr<SurfaceFrame> frame) override;
84
85 // |ExternalViewEmbedder|
86 void EndFrame(bool should_resubmit_frame,
88 raster_thread_merger) override;
89
90 // |ExternalViewEmbedder|
91 DlCanvas* GetRootCanvas() override;
92
93 // |ExternalViewEmbedder|
94 bool SupportsDynamicThreadMerging() override;
95
96 const EndFrameCallBack end_frame_call_back_;
97
98 PostPrerollResult post_preroll_result_;
99
100 bool support_thread_merging_;
101 SkISize frame_size_;
102 std::map<int64_t, std::unique_ptr<EmbedderViewSlice>> slices_;
103 std::map<int64_t, MutatorsStack> mutators_stacks_;
104 std::map<int64_t, EmbeddedViewParams> current_composition_params_;
105 std::vector<int64_t> visited_platform_views_;
106 std::atomic<int> submitted_frame_count_;
107 std::atomic<SkISize> last_submitted_frame_size_;
108
109 FML_DISALLOW_COPY_AND_ASSIGN(ShellTestExternalViewEmbedder);
110};
111
112} // namespace flutter
113
114#endif // FLUTTER_SHELL_COMMON_SHELL_TEST_EXTERNAL_VIEW_EMBEDDER_H_
Developer-facing API for rendering anything within the engine.
Definition: dl_canvas.h:38
The external view embedder used by |ShellTestPlatformViewGL|.
void UpdatePostPrerollResult(PostPrerollResult post_preroll_result)
std::function< void(bool, fml::RefPtr< fml::RasterThreadMerger >)> EndFrameCallBack
ShellTestExternalViewEmbedder(const EndFrameCallBack &end_frame_call_back, PostPrerollResult post_preroll_result, bool support_thread_merging)
const EmbeddedViewParams * params
double frame
Definition: examples.cpp:31
Dart_NativeFunction function
Definition: fuchsia.cc:51
Definition: SkSize.h:16