17 bool meets_hcpp_criteria,
19 std::shared_ptr<PlatformViewAndroidJNI> jni_facade,
20 std::shared_ptr<AndroidSurfaceFactory> surface_factory,
23 meets_hcpp_criteria_(meets_hcpp_criteria),
24 android_context_(android_context),
26 jni_facade_(
std::move(jni_facade)),
27 surface_factory_(
std::move(surface_factory)) {}
29void AndroidExternalViewEmbedderWrapper::EnsureInitialized() {
30 if (non_hcpp_view_embedder_ || hcpp_view_embedder_) {
33 if (meets_hcpp_criteria_ &&
37 hcpp_view_embedder_ = std::make_unique<AndroidExternalViewEmbedder2>(
38 android_context_, jni_facade_, surface_factory_, task_runners_);
40 non_hcpp_view_embedder_ = std::make_unique<AndroidExternalViewEmbedder>(
41 android_context_, jni_facade_, surface_factory_, task_runners_);
48 std::unique_ptr<EmbeddedViewParams>
params) {
50 if (hcpp_view_embedder_) {
51 hcpp_view_embedder_->PrerollCompositeEmbeddedView(
view_id,
54 non_hcpp_view_embedder_->PrerollCompositeEmbeddedView(
view_id,
63 if (hcpp_view_embedder_) {
64 return hcpp_view_embedder_->CompositeEmbeddedView(
view_id);
66 return non_hcpp_view_embedder_->CompositeEmbeddedView(
view_id);
72 int64_t flutter_view_id,
73 GrDirectContext* context,
74 const std::shared_ptr<impeller::AiksContext>& aiks_context,
75 std::unique_ptr<SurfaceFrame> frame) {
77 if (hcpp_view_embedder_) {
78 hcpp_view_embedder_->SubmitFlutterView(flutter_view_id, context,
79 aiks_context, std::move(frame));
81 non_hcpp_view_embedder_->SubmitFlutterView(flutter_view_id, context,
82 aiks_context, std::move(frame));
90 if (hcpp_view_embedder_) {
91 return hcpp_view_embedder_->PostPrerollAction(raster_thread_merger);
93 return non_hcpp_view_embedder_->PostPrerollAction(raster_thread_merger);
104 GrDirectContext* context,
107 if (hcpp_view_embedder_) {
108 hcpp_view_embedder_->BeginFrame(context, raster_thread_merger);
110 non_hcpp_view_embedder_->BeginFrame(context, raster_thread_merger);
117 double device_pixel_ratio) {
119 if (hcpp_view_embedder_) {
120 hcpp_view_embedder_->PrepareFlutterView(frame_size, device_pixel_ratio);
122 non_hcpp_view_embedder_->PrepareFlutterView(frame_size, device_pixel_ratio);
129 if (hcpp_view_embedder_) {
130 hcpp_view_embedder_->CancelFrame();
132 non_hcpp_view_embedder_->CancelFrame();
138 bool should_resubmit_frame,
141 if (hcpp_view_embedder_) {
142 hcpp_view_embedder_->EndFrame(should_resubmit_frame, raster_thread_merger);
144 non_hcpp_view_embedder_->EndFrame(should_resubmit_frame,
145 raster_thread_merger);
152 if (hcpp_view_embedder_) {
153 return hcpp_view_embedder_->SupportsDynamicThreadMerging();
155 return non_hcpp_view_embedder_->SupportsDynamicThreadMerging();
162 if (hcpp_view_embedder_) {
163 hcpp_view_embedder_->Teardown();
165 non_hcpp_view_embedder_->Teardown();
Holds state that is shared across Android surfaces.
virtual AndroidRenderingAPI RenderingApi() const
virtual std::shared_ptr< impeller::Context > GetImpellerContext() const
Accessor for the Impeller context associated with AndroidSurfaces and the raster thread.
void PrepareFlutterView(DlISize frame_size, double device_pixel_ratio) override
DlCanvas * CompositeEmbeddedView(int64_t view_id) override
void CancelFrame() override
void PrerollCompositeEmbeddedView(int64_t view_id, std::unique_ptr< flutter::EmbeddedViewParams > params) override
void EndFrame(bool should_resubmit_frame, const fml::RefPtr< fml::RasterThreadMerger > &raster_thread_merger) override
DlCanvas * GetRootCanvas() override
PostPrerollResult PostPrerollAction(const fml::RefPtr< fml::RasterThreadMerger > &raster_thread_merger) override
bool SupportsDynamicThreadMerging() override
AndroidExternalViewEmbedderWrapper(bool meets_hcpp_criteria, const AndroidContext &android_context, std::shared_ptr< PlatformViewAndroidJNI > jni_facade, std::shared_ptr< AndroidSurfaceFactory > surface_factory, const TaskRunners &task_runners)
void BeginFrame(GrDirectContext *context, const fml::RefPtr< fml::RasterThreadMerger > &raster_thread_merger) override
void SubmitFlutterView(int64_t flutter_view_id, GrDirectContext *context, const std::shared_ptr< impeller::AiksContext > &aiks_context, std::unique_ptr< SurfaceFrame > frame) override
Developer-facing API for rendering anything within the engine.
static ContextVK & Cast(Context &base)
bool GetShouldEnableSurfaceControlSwapchain() const
Whether the Android Surface control based swapchain should be enabled.
const EmbeddedViewParams * params
TaskRunners task_runners_
G_BEGIN_DECLS FlutterViewId view_id