Flutter Engine
FlutterEngine_Internal.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_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTER_ENGINE_INTERNAL_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTER_ENGINE_INTERNAL_H_
7 
8 #import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h"
9 
10 #include "flutter/fml/memory/weak_ptr.h"
11 #include "flutter/fml/task_runner.h"
12 #include "flutter/lib/ui/window/pointer_data_packet.h"
13 #include "flutter/lib/ui/window/viewport_metrics.h"
14 #include "flutter/shell/common/platform_view.h"
15 #include "flutter/shell/common/rasterizer.h"
16 #include "flutter/shell/common/shell.h"
17 
18 // Embedder header included as an implementation detail (See BUILD.gn), iOS
19 // doesn't use the embedding API, just some structures from it.
20 #include "flutter/shell/platform/embedder/embedder.h"
21 
22 #import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h"
23 #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h"
24 #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.h"
25 #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h"
26 #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterRestorationPlugin.h"
27 #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputDelegate.h"
28 #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.h"
29 #import "flutter/shell/platform/darwin/ios/platform_view_ios.h"
30 
31 extern NSString* _Nonnull const FlutterEngineWillDealloc;
32 
33 @interface FlutterEngine () <FlutterViewEngineDelegate>
34 
35 - (flutter::Shell&)shell;
36 
37 - (void)updateViewportMetrics:(flutter::ViewportMetrics)viewportMetrics;
38 - (void)dispatchPointerDataPacket:(std::unique_ptr<flutter::PointerDataPacket>)packet;
39 
40 - (fml::RefPtr<fml::TaskRunner>)platformTaskRunner;
41 - (fml::RefPtr<fml::TaskRunner>)RasterTaskRunner;
42 
43 - (fml::WeakPtr<flutter::PlatformView>)platformView;
44 
45 - (flutter::Rasterizer::Screenshot)screenshot:(flutter::Rasterizer::ScreenshotType)type
46  base64Encode:(bool)base64Encode;
47 
48 - (nonnull FlutterPlatformPlugin*)platformPlugin;
49 - (std::shared_ptr<flutter::FlutterPlatformViewsController>&)platformViewsController;
51 - (nonnull FlutterRestorationPlugin*)restorationPlugin;
52 - (void)launchEngine:(nullable NSString*)entrypoint libraryURI:(nullable NSString*)libraryOrNil;
53 - (BOOL)createShell:(nullable NSString*)entrypoint
54  libraryURI:(nullable NSString*)libraryOrNil
55  initialRoute:(nullable NSString*)initialRoute;
56 - (void)attachView;
57 - (void)notifyLowMemory;
58 - (nonnull flutter::PlatformViewIOS*)iosPlatformView;
59 
60 - (void)waitForFirstFrame:(NSTimeInterval)timeout
61  callback:(nonnull void (^)(BOOL didTimeout))callback;
62 
63 /**
64  * Creates one running FlutterEngine from another, sharing components between them.
65  *
66  * This results in a faster creation time and a smaller memory footprint engine.
67  * This should only be called on a FlutterEngine that is running.
68  */
69 - (nonnull FlutterEngine*)spawnWithEntrypoint:(nullable NSString*)entrypoint
70  libraryURI:(nullable NSString*)libraryURI
71  initialRoute:(nullable NSString*)initialRoute;
72 
73 /**
74  * Dispatches the given key event data to the framework through the engine.
75  * The callback is called once the response from the framework is received.
76  */
77 - (void)sendKeyEvent:(const FlutterKeyEvent&)event
78  callback:(nullable FlutterKeyEventCallback)callback
79  userData:(nullable void*)userData;
80 @end
81 
82 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTER_ENGINE_INTERNAL_H_
NSString *_Nonnull const FlutterEngineWillDealloc
FlutterTextInputPlugin * textInputPlugin
Definition: ref_ptr.h:252
Definition: ascii_trie.cc:9
int BOOL
Definition: windows_types.h:37
void(* FlutterKeyEventCallback)(bool, void *)
Definition: embedder.h:748