5#ifndef FLUTTER_SHELL_PLATFORM_ANDROID_EXTERNAL_VIEW_EMBEDDER_EXTERNAL_VIEW_EMBEDDER_H_
6#define FLUTTER_SHELL_PLATFORM_ANDROID_EXTERNAL_VIEW_EMBEDDER_EXTERNAL_VIEW_EMBEDDER_H_
8#include <unordered_map>
10#include "flutter/common/task_runners.h"
11#include "flutter/flow/embedded_views.h"
12#include "flutter/shell/platform/android/context/android_context.h"
13#include "flutter/shell/platform/android/external_view_embedder/surface_pool.h"
14#include "flutter/shell/platform/android/jni/platform_view_android_jni.h"
15#include "flutter/shell/platform/android/surface/android_surface.h"
33 std::shared_ptr<PlatformViewAndroidJNI> jni_facade,
34 std::shared_ptr<AndroidSurfaceFactory> surface_factory,
40 std::unique_ptr<flutter::EmbeddedViewParams>
params)
override;
47 int64_t flutter_view_id,
49 const std::shared_ptr<impeller::AiksContext>& aiks_context,
50 std::unique_ptr<SurfaceFrame>
frame)
override;
63 raster_thread_merger)
override;
67 double device_pixel_ratio)
override;
73 void EndFrame(
bool should_resubmit_frame,
75 raster_thread_merger)
override;
91 static const int kDefaultMergedLeaseDuration = 10;
97 const std::shared_ptr<PlatformViewAndroidJNI> jni_facade_;
100 const std::shared_ptr<AndroidSurfaceFactory> surface_factory_;
103 const std::unique_ptr<SurfacePool> surface_pool_;
113 double device_pixel_ratio_;
117 std::vector<int64_t> composition_order_;
122 std::unordered_map<int64_t, std::unique_ptr<EmbedderViewSlice>> slices_;
126 std::unordered_map<int64_t, EmbeddedViewParams> view_params_;
129 int64_t previous_frame_view_count_;
134 void DestroySurfaces();
140 bool FrameHasPlatformLayers();
144 std::unique_ptr<SurfaceFrame> CreateSurfaceIfNeeded(
GrDirectContext* context,
Holds state that is shared across Android surfaces.
void EndFrame(bool should_resubmit_frame, const fml::RefPtr< fml::RasterThreadMerger > &raster_thread_merger) override
PostPrerollResult PostPrerollAction(const fml::RefPtr< fml::RasterThreadMerger > &raster_thread_merger) override
void PrerollCompositeEmbeddedView(int64_t view_id, std::unique_ptr< flutter::EmbeddedViewParams > params) override
void CancelFrame() override
void SubmitFlutterView(int64_t flutter_view_id, GrDirectContext *context, const std::shared_ptr< impeller::AiksContext > &aiks_context, std::unique_ptr< SurfaceFrame > frame) override
DlCanvas * CompositeEmbeddedView(int64_t view_id) override
void BeginFrame(GrDirectContext *context, const fml::RefPtr< fml::RasterThreadMerger > &raster_thread_merger) override
AndroidExternalViewEmbedder(const AndroidContext &android_context, std::shared_ptr< PlatformViewAndroidJNI > jni_facade, std::shared_ptr< AndroidSurfaceFactory > surface_factory, const TaskRunners &task_runners)
SkRect GetViewRect(int64_t view_id) const
bool SupportsDynamicThreadMerging() override
DlCanvas * GetRootCanvas() override
void PrepareFlutterView(SkISize frame_size, double device_pixel_ratio) override
Developer-facing API for rendering anything within the engine.
const EmbeddedViewParams * params
sk_sp< SkBlender > blender SkRect rect