Flutter Engine
 
Loading...
Searching...
No Matches
FlutterEngine.mm File Reference
#include <UIKit/UIKit.h>
#include "common/settings.h"
import "flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine_Internal.h"
#include <memory>
#include "flutter/common/constants.h"
#include "flutter/fml/message_loop.h"
#include "flutter/fml/platform/darwin/platform_version.h"
#include "flutter/fml/trace_event.h"
#include "flutter/runtime/ptrace_check.h"
#include "flutter/shell/common/engine.h"
#include "flutter/shell/common/platform_view.h"
#include "flutter/shell/common/shell.h"
#include "flutter/shell/common/switches.h"
#include "flutter/shell/common/thread_host.h"
#include "flutter/shell/common/variable_refresh_rate_display.h"
import "flutter/shell/platform/darwin/common/InternalFlutterSwiftCommon/InternalFlutterSwiftCommon.h"
import "flutter/shell/platform/darwin/common/command_line.h"
import "flutter/shell/platform/darwin/common/framework/Source/FlutterBinaryMessengerRelay.h"
import "flutter/shell/platform/darwin/ios/InternalFlutterSwift/InternalFlutterSwift.h"
import "flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h"
import "flutter/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.h"
import "flutter/shell/platform/darwin/ios/framework/Source/FlutterIndirectScribbleDelegate.h"
import "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.h"
import "flutter/shell/platform/darwin/ios/framework/Source/FlutterSharedApplication.h"
import "flutter/shell/platform/darwin/ios/framework/Source/FlutterSpellCheckPlugin.h"
import "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputDelegate.h"
import "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextureRegistryRelay.h"
import "flutter/shell/platform/darwin/ios/framework/Source/FlutterUndoManagerDelegate.h"
import "flutter/shell/platform/darwin/ios/framework/Source/FlutterUndoManagerPlugin.h"
import "flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController_Internal.h"
import "flutter/shell/platform/darwin/ios/framework/Source/UIViewController+FlutterScreenAndSceneIfLoaded.h"
import "flutter/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.h"
import "flutter/shell/platform/darwin/ios/framework/Source/profiler_metrics_ios.h"
import "flutter/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.h"
import "flutter/shell/platform/darwin/ios/platform_view_ios.h"
import "flutter/shell/platform/darwin/ios/rendering_api_selection.h"
#include "flutter/shell/profiling/sampling_profiler.h"

Go to the source code of this file.

Classes

class  FlutterEngineBaseRegistrar
 
class  FlutterEngineApplicationRegistrar
 
class  FlutterEnginePluginRegistrar
 

Macros

#define FML_USED_ON_EMBEDDER
 

Functions

static FLUTTER_ASSERT_ARC void IOSPlatformThreadConfigSetter (const fml::Thread::ThreadConfig &config)
 

Variables

NSString *const FlutterDefaultDartEntrypoint = nil
 
NSString *const FlutterDefaultInitialRoute = nil
 
NSString *const kFlutterKeyDataChannel = @"@"flutter/keydata"
 
static constexpr int kNumProfilerSamplesPerSec = 5
 
NSString *const kFlutterApplicationRegistrarKey = @"@"io.flutter.flutter.application_registrar"
 
NSObject< FlutterApplicationRegistrar > * _appRegistrar
 
std::unique_ptr< flutter::Shell_shell
 
flutter::IOSRenderingAPI _renderingApi
 
std::shared_ptr< flutter::SamplingProfiler_profiler
 
FlutterBinaryMessengerRelay_binaryMessenger
 
FlutterTextureRegistryRelay_textureRegistry
 

Macro Definition Documentation

◆ FML_USED_ON_EMBEDDER

#define FML_USED_ON_EMBEDDER

Definition at line 7 of file FlutterEngine.mm.

Function Documentation

◆ IOSPlatformThreadConfigSetter()

static FLUTTER_ASSERT_ARC void IOSPlatformThreadConfigSetter ( const fml::Thread::ThreadConfig config)
static

Inheriting ThreadConfigurer and use iOS platform thread API to configure the thread priorities Using iOS platform thread API to configure thread priority

Definition at line 51 of file FlutterEngine.mm.

51 {
52 // set thread name
54
55 // set thread priority
56 switch (config.priority) {
58 pthread_set_qos_class_self_np(QOS_CLASS_BACKGROUND, 0);
59 [[NSThread currentThread] setThreadPriority:0];
60 break;
61 }
63 pthread_set_qos_class_self_np(QOS_CLASS_DEFAULT, 0);
64 [[NSThread currentThread] setThreadPriority:0.5];
65 break;
66 }
69 pthread_set_qos_class_self_np(QOS_CLASS_USER_INTERACTIVE, 0);
70 [[NSThread currentThread] setThreadPriority:1.0];
71 sched_param param;
72 int policy;
73 pthread_t thread = pthread_self();
74 if (!pthread_getschedparam(thread, &policy, &param)) {
75 param.sched_priority = 50;
76 pthread_setschedparam(thread, policy, &param);
77 }
78 break;
79 }
80 }
81}
@ kNormal
Default priority level.
@ kRaster
Suitable for thread which raster data.
@ kBackground
Suitable for threads that shouldn't disrupt high priority work.
@ kDisplay
Suitable for threads which generate data for the display.
static void SetCurrentThreadName(const ThreadConfig &config)
Definition thread.cc:135
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network policy
ThreadPriority priority
Definition thread.h:45

References fml::Thread::kBackground, fml::Thread::kDisplay, fml::Thread::kNormal, fml::Thread::kRaster, fml::Thread::ThreadConfig::priority, and fml::Thread::SetCurrentThreadName().

Variable Documentation

◆ _appRegistrar

NSObject<FlutterApplicationRegistrar>* _appRegistrar
Initial value:

Definition at line 171 of file FlutterEngine.mm.

◆ _binaryMessenger

◆ _profiler

std::shared_ptr<flutter::SamplingProfiler> _profiler

Definition at line 197 of file FlutterEngine.mm.

◆ _renderingApi

flutter::IOSRenderingAPI _renderingApi

Definition at line 196 of file FlutterEngine.mm.

◆ _shell

std::unique_ptr<flutter::Shell> _shell
Initial value:
{
std::shared_ptr<flutter::ThreadHost> _threadHost

Definition at line 194 of file FlutterEngine.mm.

◆ _textureRegistry

FlutterTextureRegistryRelay* _textureRegistry

Definition at line 200 of file FlutterEngine.mm.

◆ FlutterDefaultDartEntrypoint

NSString* const FlutterDefaultDartEntrypoint = nil

The dart entrypoint that is associated with main(). This is to be used as an argument to the runWithEntrypoint* methods.

Definition at line 85 of file FlutterEngine.mm.

◆ FlutterDefaultInitialRoute

NSString* const FlutterDefaultInitialRoute = nil

The default Flutter initial route ("/").

Definition at line 86 of file FlutterEngine.mm.

◆ kFlutterApplicationRegistrarKey

NSString* const kFlutterApplicationRegistrarKey = @"@"io.flutter.flutter.application_registrar"

Definition at line 92 of file FlutterEngine.mm.

◆ kFlutterKeyDataChannel

NSString* const kFlutterKeyDataChannel = @"@"flutter/keydata"

Definition at line 90 of file FlutterEngine.mm.

◆ kNumProfilerSamplesPerSec

constexpr int kNumProfilerSamplesPerSec = 5
staticconstexpr

Definition at line 91 of file FlutterEngine.mm.