| Flutter iOS Embedder |

ios_external_view_embedder.mm
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 #import "flutter/shell/platform/darwin/ios/ios_external_view_embedder.h"
6
7 namespace flutter {
8
9 IOSExternalViewEmbedder::IOSExternalViewEmbedder(
10 const std::shared_ptr<FlutterPlatformViewsController>& platform_views_controller,
11 std::shared_ptr<IOSContext> context)
12 : platform_views_controller_(platform_views_controller), ios_context_(std::move(context)) {
13 FML_CHECK(ios_context_);
14 }
15
16 IOSExternalViewEmbedder::~IOSExternalViewEmbedder() = default;
17
18 // |ExternalViewEmbedder|
19 DlCanvas* IOSExternalViewEmbedder::GetRootCanvas() {
20 // On iOS, the root surface is created from the on-screen render target. Only the surfaces for the
21 // various overlays are controlled by this class.
22 return nullptr;
23 }
24
25 // |ExternalViewEmbedder|
26 void IOSExternalViewEmbedder::CancelFrame() {
27 TRACE_EVENT0("flutter", "IOSExternalViewEmbedder::CancelFrame");
28 FML_CHECK(platform_views_controller_);
29 platform_views_controller_->CancelFrame();
30 }
31
32 // |ExternalViewEmbedder|
33 void IOSExternalViewEmbedder::BeginFrame(
34 SkISize frame_size,
35 GrDirectContext* context,
36 double device_pixel_ratio,
37 fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger) {
38 TRACE_EVENT0("flutter", "IOSExternalViewEmbedder::BeginFrame");
39 FML_CHECK(platform_views_controller_);
40 platform_views_controller_->BeginFrame(frame_size);
41 }
42
43 // |ExternalViewEmbedder|
44 void IOSExternalViewEmbedder::PrerollCompositeEmbeddedView(
45 int64_t view_id,
46 std::unique_ptr<EmbeddedViewParams> params) {
47 TRACE_EVENT0("flutter", "IOSExternalViewEmbedder::PrerollCompositeEmbeddedView");
48 FML_CHECK(platform_views_controller_);
49 platform_views_controller_->PrerollCompositeEmbeddedView(view_id, std::move(params));
50 }
51
52 // |ExternalViewEmbedder|
53 PostPrerollResult IOSExternalViewEmbedder::PostPrerollAction(
54 fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger) {
55 TRACE_EVENT0("flutter", "IOSExternalViewEmbedder::PostPrerollAction");
56 FML_CHECK(platform_views_controller_);
57 PostPrerollResult result = platform_views_controller_->PostPrerollAction(raster_thread_merger);
58 return result;
59 }
60
61 // |ExternalViewEmbedder|
62 DlCanvas* IOSExternalViewEmbedder::CompositeEmbeddedView(int64_t view_id) {
63 TRACE_EVENT0("flutter", "IOSExternalViewEmbedder::CompositeEmbeddedView");
64 FML_CHECK(platform_views_controller_);
65 return platform_views_controller_->CompositeEmbeddedView(view_id);
66 }
67
68 // |ExternalViewEmbedder|
69 void IOSExternalViewEmbedder::SubmitFrame(
70 GrDirectContext* context,
71 const std::shared_ptr<impeller::AiksContext>& aiks_context,
72 std::unique_ptr<SurfaceFrame> frame) {
73 TRACE_EVENT0("flutter", "IOSExternalViewEmbedder::SubmitFrame");
74 FML_CHECK(platform_views_controller_);
75 platform_views_controller_->SubmitFrame(context, ios_context_, std::move(frame));
76 TRACE_EVENT0("flutter", "IOSExternalViewEmbedder::DidSubmitFrame");
77 }
78
79 // |ExternalViewEmbedder|
80 void IOSExternalViewEmbedder::EndFrame(bool should_resubmit_frame,
81 fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger) {
82 TRACE_EVENT0("flutter", "IOSExternalViewEmbedder::EndFrame");
83 platform_views_controller_->EndFrame(should_resubmit_frame, raster_thread_merger);
84 }
85
86 // |ExternalViewEmbedder|
87 bool IOSExternalViewEmbedder::SupportsDynamicThreadMerging() {
88 return true;
89 }
90
91 // |ExternalViewEmbedder|
92 void IOSExternalViewEmbedder::PushFilterToVisitedPlatformViews(
93 std::shared_ptr<const DlImageFilter> filter,
94 const SkRect& filter_rect) {
95 platform_views_controller_->PushFilterToVisitedPlatformViews(filter, filter_rect);
96 }
97
98 // |ExternalViewEmbedder|
99 void IOSExternalViewEmbedder::PushVisitedPlatformView(int64_t view_id) {
100 platform_views_controller_->PushVisitedPlatformView(view_id);
101 }
102
103 } // namespace flutter
ios_external_view_embedder.h
flutter::IOSExternalViewEmbedder::~IOSExternalViewEmbedder
virtual ~IOSExternalViewEmbedder() override
flutter
Definition: accessibility_bridge.h:28
flutter::IOSExternalViewEmbedder::IOSExternalViewEmbedder
IOSExternalViewEmbedder(const std::shared_ptr< FlutterPlatformViewsController > &platform_views_controller, std::shared_ptr< IOSContext > context)
Definition: ios_external_view_embedder.mm:9