Flutter Engine
The Flutter Engine
|
#include <shell.h>
Public Types | |
template<class T > | |
using | CreateCallback = std::function< std::unique_ptr< T >(Shell &)> |
typedef std::function< std::unique_ptr< Engine >(Engine::Delegate &delegate, const PointerDataDispatcherMaker &dispatcher_maker, DartVM &vm, fml::RefPtr< const DartSnapshot > isolate_snapshot, TaskRunners task_runners, const PlatformData &platform_data, Settings settings, std::unique_ptr< Animator > animator, fml::WeakPtr< IOManager > io_manager, fml::RefPtr< SkiaUnrefQueue > unref_queue, fml::TaskRunnerAffineWeakPtr< SnapshotDelegate > snapshot_delegate, std::shared_ptr< VolatilePathTracker > volatile_path_tracker, const std::shared_ptr< fml::SyncSwitch > &gpu_disabled_switch, impeller::RuntimeStageBackend runtime_stage_type)> | EngineCreateCallback |
Public Types inherited from flutter::PlatformView::Delegate | |
using | AddViewCallback = PlatformView::AddViewCallback |
using | RemoveViewCallback = PlatformView::RemoveViewCallback |
using | KeyDataResponse = std::function< void(bool)> |
Public Types inherited from flutter::ServiceProtocol::Handler | |
using | ServiceProtocolMap = std::map< std::string_view, std::string_view > |
Public Member Functions | |
~Shell () | |
Destroys the shell. This is a synchronous operation and synchronous barrier blocks are introduced on the various threads to ensure shutdown of all shell sub-components before this method returns. More... | |
std::unique_ptr< Shell > | Spawn (RunConfiguration run_configuration, const std::string &initial_route, const CreateCallback< PlatformView > &on_create_platform_view, const CreateCallback< Rasterizer > &on_create_rasterizer) const |
Creates one Shell from another Shell where the created Shell takes the opportunity to share any internal components it can. This results is a Shell that has a smaller startup time cost and a smaller memory footprint than an Shell created with the Create function. More... | |
void | RunEngine (RunConfiguration run_configuration) |
Starts an isolate for the given RunConfiguration. More... | |
void | RunEngine (RunConfiguration run_configuration, const std::function< void(Engine::RunStatus)> &result_callback) |
Starts an isolate for the given RunConfiguration. The result_callback will be called with the status of the operation. More... | |
const Settings & | GetSettings () const override |
const TaskRunners & | GetTaskRunners () const override |
If callers wish to interact directly with any shell subcomponents, they must (on the platform thread) obtain a task runner that the component is designed to run on and a weak pointer to that component. They may then post a task to that task runner, do the validity check on that task runner before performing any operation on that component. This accessor allows callers to access the task runners for this shell. More... | |
const fml::RefPtr< fml::RasterThreadMerger > | GetParentRasterThreadMerger () const override |
Getting the raster thread merger from parent shell, it can be a null RefPtr when it's a root Shell or the embedder_->SupportsDynamicThreadMerging() returns false. More... | |
fml::TaskRunnerAffineWeakPtr< Rasterizer > | GetRasterizer () const |
Rasterizers may only be accessed on the raster task runner. More... | |
fml::WeakPtr< Engine > | GetEngine () |
Engines may only be accessed on the UI thread. This method is deprecated, and implementers should instead use other API available on the Shell or the PlatformView. More... | |
fml::WeakPtr< PlatformView > | GetPlatformView () |
Platform views may only be accessed on the platform task runner. More... | |
fml::WeakPtr< ShellIOManager > | GetIOManager () |
The IO Manager may only be accessed on the IO task runner. More... | |
void | NotifyLowMemoryWarning () const |
Used by embedders to notify that there is a low memory warning. The shell will attempt to purge caches. Current, only the rasterizer cache is purged. More... | |
bool | IsSetup () const |
Used by embedders to check if all shell subcomponents are initialized. It is the embedder's responsibility to make this call before accessing any other shell method. A shell that is not set up must be discarded and another one created with updated settings. More... | |
Rasterizer::Screenshot | Screenshot (Rasterizer::ScreenshotType type, bool base64_encode) |
Captures a screenshot and optionally Base64 encodes the data of the last layer tree rendered by the rasterizer in this shell. More... | |
fml::Status | WaitForFirstFrame (fml::TimeDelta timeout) |
Pauses the calling thread until the first frame is presented. More... | |
bool | ReloadSystemFonts () |
Used by embedders to reload the system fonts in FontCollection. It also clears the cached font families and send system channel message to framework to rebuild affected widgets. More... | |
std::optional< DartErrorCode > | GetUIIsolateLastError () const |
Used by embedders to get the last error from the Dart UI Isolate, if one exists. More... | |
bool | EngineHasLivePorts () const |
Used by embedders to check if the Engine is running and has any live ports remaining. For example, the Flutter tester uses this method to check whether it should continue to wait for a running test or not. More... | |
std::shared_ptr< const fml::SyncSwitch > | GetIsGpuDisabledSyncSwitch () const override |
Accessor for the disable GPU SyncSwitch. More... | |
void | SetGpuAvailability (GpuAvailability availability) |
Marks the GPU as available or unavailable. More... | |
DartVM * | GetDartVM () |
Get a pointer to the Dart VM used by this running shell instance. More... | |
void | OnDisplayUpdates (std::vector< std::unique_ptr< Display > > displays) |
Notifies the display manager of the updates. More... | |
double | GetMainDisplayRefreshRate () |
Queries the DisplayManager for the main display refresh rate. More... | |
void | RegisterImageDecoder (ImageGeneratorFactory factory, int32_t priority) |
Install a new factory that can match against and decode image data. More... | |
const std::shared_ptr< PlatformMessageHandler > & | GetPlatformMessageHandler () const override |
Returns the delegate object that handles PlatformMessage's from Flutter to the host platform (and its responses). More... | |
const std::weak_ptr< VsyncWaiter > | GetVsyncWaiter () const |
const std::shared_ptr< fml::ConcurrentTaskRunner > | GetConcurrentWorkerTaskRunner () const |
Public Member Functions inherited from flutter::PlatformView::Delegate | |
virtual void | OnPlatformViewCreated (std::unique_ptr< Surface > surface)=0 |
Notifies the delegate that the platform view was created with the given render surface. This surface is platform (iOS, Android) and client-rendering API (OpenGL, Software, Metal, Vulkan) specific. This is usually a sign to the rasterizer to set up and begin rendering to that surface. More... | |
virtual void | OnPlatformViewDestroyed ()=0 |
Notifies the delegate that the platform view was destroyed. This is usually a sign to the rasterizer to suspend rendering a previously configured surface and collect any intermediate resources. More... | |
virtual void | OnPlatformViewScheduleFrame ()=0 |
Notifies the delegate that the platform needs to schedule a frame to regenerate the layer tree and redraw the surface. More... | |
virtual void | OnPlatformViewAddView (int64_t view_id, const ViewportMetrics &viewport_metrics, AddViewCallback callback)=0 |
Allocate resources for a new non-implicit view and inform Dart about the view, and on success, schedules a new frame. More... | |
virtual void | OnPlatformViewRemoveView (int64_t view_id, RemoveViewCallback callback)=0 |
Deallocate resources for a removed view and inform Dart about the removal. More... | |
virtual void | OnPlatformViewSetNextFrameCallback (const fml::closure &closure)=0 |
Notifies the delegate that the specified callback needs to be invoked after the rasterizer is done rendering the next frame. This callback will be called on the render thread and it is caller responsibility to perform any re-threading as necessary. Due to the asynchronous nature of rendering in Flutter, embedders usually add a placeholder over the contents in which Flutter is going to render when Flutter is first initialized. This callback may be used as a signal to remove that placeholder. More... | |
virtual void | OnPlatformViewSetViewportMetrics (int64_t view_id, const ViewportMetrics &metrics)=0 |
Notifies the delegate the viewport metrics of a view have been updated. The rasterizer will need to be reconfigured to render the frame in the updated viewport metrics. More... | |
virtual void | OnPlatformViewDispatchPlatformMessage (std::unique_ptr< PlatformMessage > message)=0 |
Notifies the delegate that the platform has dispatched a platform message from the embedder to the Flutter application. This message must be forwarded to the running isolate hosted by the engine on the UI thread. More... | |
virtual void | OnPlatformViewDispatchPointerDataPacket (std::unique_ptr< PointerDataPacket > packet)=0 |
Notifies the delegate that the platform view has encountered a pointer event. This pointer event needs to be forwarded to the running root isolate hosted by the engine on the UI thread. More... | |
virtual void | OnPlatformViewDispatchSemanticsAction (int32_t node_id, SemanticsAction action, fml::MallocMapping args)=0 |
Notifies the delegate that the platform view has encountered an accessibility related action on the specified node. This event must be forwarded to the running root isolate hosted by the engine on the UI thread. More... | |
virtual void | OnPlatformViewSetSemanticsEnabled (bool enabled)=0 |
Notifies the delegate that the embedder has expressed an opinion about whether the accessibility tree needs to be enabled or disabled. This information needs to be forwarded to the root isolate running on the UI thread. More... | |
virtual void | OnPlatformViewSetAccessibilityFeatures (int32_t flags)=0 |
Notifies the delegate that the embedder has expressed an opinion about the features to enable in the accessibility tree. More... | |
virtual void | OnPlatformViewRegisterTexture (std::shared_ptr< Texture > texture)=0 |
Notifies the delegate that the embedder has specified a texture that it want the rasterizer to composite within the Flutter layer tree. All textures must have a unique identifier. When the rasterizer encounters an external texture within its hierarchy, it gives the embedder a chance to update that texture on the raster thread before it composites the same on-screen. More... | |
virtual void | OnPlatformViewUnregisterTexture (int64_t texture_id)=0 |
Notifies the delegate that the embedder will no longer attempt to composite the specified texture within the layer tree. This allows the rasterizer to collect associated resources. More... | |
virtual void | OnPlatformViewMarkTextureFrameAvailable (int64_t texture_id)=0 |
Notifies the delegate that the embedder has updated the contents of the texture with the specified identifier. Typically, Flutter will only render a frame if there is an updated layer tree. However, in cases where the layer tree is static but one of the externally composited textures has been updated by the embedder, the embedder needs to notify the rasterizer to render a new frame. In such cases, the existing layer tree may be reused with the frame composited with all updated external textures. More... | |
virtual void | LoadDartDeferredLibrary (intptr_t loading_unit_id, std::unique_ptr< const fml::Mapping > snapshot_data, std::unique_ptr< const fml::Mapping > snapshot_instructions)=0 |
Loads the dart shared library into the dart VM. When the dart library is loaded successfully, the dart future returned by the originating loadLibrary() call completes. More... | |
virtual void | LoadDartDeferredLibraryError (intptr_t loading_unit_id, const std::string error_message, bool transient)=0 |
Indicates to the dart VM that the request to load a deferred library with the specified loading unit id has failed. More... | |
virtual void | UpdateAssetResolverByType (std::unique_ptr< AssetResolver > updated_asset_resolver, AssetResolver::AssetResolverType type)=0 |
Replaces the asset resolver handled by the engine's AssetManager of the specified type with updated_asset_resolver . The matching AssetResolver is removed and replaced with updated_asset_resolvers . More... | |
virtual const Settings & | OnPlatformViewGetSettings () const =0 |
Called by the platform view on the platform thread to get the settings object associated with the platform view instance. More... | |
virtual void | OnAnimatorBeginFrame (fml::TimePoint frame_target_time, uint64_t frame_number)=0 |
virtual void | OnAnimatorNotifyIdle (fml::TimeDelta deadline)=0 |
virtual void | OnAnimatorUpdateLatestFrameTargetTime (fml::TimePoint frame_target_time)=0 |
virtual void | OnAnimatorDraw (std::shared_ptr< FramePipeline > pipeline)=0 |
virtual void | OnAnimatorDrawLastLayerTrees (std::unique_ptr< FrameTimingsRecorder > frame_timings_recorder)=0 |
virtual void | OnEngineUpdateSemantics (SemanticsNodeUpdates updates, CustomAccessibilityActionUpdates actions)=0 |
When the accessibility tree has been updated by the Flutter application, this new information needs to be conveyed to the underlying platform. The engine delegates this task to the shell via this call. The engine cannot access the underlying platform directly because of threading considerations. Most platform specific APIs to convey accessibility information are only safe to access on the platform task runner while the engine is running on the UI task runner. More... | |
virtual void | OnEngineHandlePlatformMessage (std::unique_ptr< PlatformMessage > message)=0 |
When the Flutter application has a message to send to the underlying platform, the message needs to be forwarded to the platform on the appropriate thread (via the platform task runner). The engine delegates this task to the shell via this method. More... | |
virtual void | OnPreEngineRestart ()=0 |
Notifies the delegate that the root isolate of the application is about to be discarded and a new isolate with the same runtime started in its place. This should only happen in the Flutter "debug" runtime mode in the cold-restart scenario. The embedder may need to reset native resource in response to the restart. More... | |
virtual void | OnRootIsolateCreated ()=0 |
Notifies the shell that the root isolate is created. Currently, this information is to add to the service protocol list of available root isolates running in the VM and their names so that the appropriate isolate can be selected in the tools for debugging and instrumentation. More... | |
virtual void | UpdateIsolateDescription (const std::string isolate_name, int64_t isolate_port)=0 |
Notifies the shell of the name of the root isolate and its port when that isolate is launched, restarted (in the cold-restart scenario) or the application itself updates the name of the root isolate (via PlatformDispatcher.setIsolateDebugName in platform_dispatcher.dart ). The name of the isolate is meaningless to the engine but is used in instrumentation and tooling. Currently, this information is to update the service protocol list of available root isolates running in the VM and their names so that the appropriate isolate can be selected in the tools for debugging and instrumentation. More... | |
virtual void | SetNeedsReportTimings (bool needs_reporting)=0 |
Notifies the shell that the application has an opinion about whether its frame timings need to be reported backed to it. Due to the asynchronous nature of rendering in Flutter, it is not possible for the application to determine the total time it took to render a specific frame. While the layer-tree is constructed on the UI thread, it needs to be rendering on the raster thread. Dart code cannot execute on this thread. So any instrumentation about the frame times gathered on this thread needs to be aggregated and sent back to the UI thread for processing in Dart. More... | |
virtual std::unique_ptr< std::vector< std::string > > | ComputePlatformResolvedLocale (const std::vector< std::string > &supported_locale_data)=0 |
Directly invokes platform-specific APIs to compute the locale the platform would have natively resolved to. More... | |
virtual void | RequestDartDeferredLibrary (intptr_t loading_unit_id)=0 |
Invoked when the Dart VM requests that a deferred library be loaded. Notifies the engine that the deferred library identified by the specified loading unit id should be downloaded and loaded into the Dart VM via LoadDartDeferredLibrary More... | |
virtual fml::TimePoint | GetCurrentTimePoint ()=0 |
Returns the current fml::TimePoint. This method is primarily provided to allow tests to control Any methods that rely on advancing the clock. More... | |
virtual const std::shared_ptr< PlatformMessageHandler > & | GetPlatformMessageHandler () const =0 |
Returns the delegate object that handles PlatformMessage's from Flutter to the host platform (and its responses). More... | |
virtual void | OnEngineChannelUpdate (std::string name, bool listening)=0 |
Invoked when a listener is registered on a platform channel. More... | |
virtual double | GetScaledFontSize (double unscaled_font_size, int configuration_id) const =0 |
Synchronously invokes platform-specific APIs to apply the system text scaling on the given unscaled font size. More... | |
virtual void | OnFrameRasterized (const FrameTiming &frame_timing)=0 |
Notifies the delegate that a frame has been rendered. The rasterizer collects profiling information for each part of the frame workload. This profiling information is made available to the delegate for forwarding to subsystems interested in collecting such profiles. Currently, the shell (the delegate) forwards this to the engine where Dart code can react to this information. More... | |
virtual fml::Milliseconds | GetFrameBudget ()=0 |
virtual fml::TimePoint | GetLatestFrameTargetTime () const =0 |
virtual const TaskRunners & | GetTaskRunners () const =0 |
Task runners used by the shell. More... | |
virtual const fml::RefPtr< fml::RasterThreadMerger > | GetParentRasterThreadMerger () const =0 |
The raster thread merger from parent shell's rasterizer. More... | |
virtual std::shared_ptr< const fml::SyncSwitch > | GetIsGpuDisabledSyncSwitch () const =0 |
virtual const Settings & | GetSettings () const =0 |
virtual bool | ShouldDiscardLayerTree (int64_t view_id, const flutter::LayerTree &tree)=0 |
virtual fml::RefPtr< fml::TaskRunner > | GetServiceProtocolHandlerTaskRunner (std::string_view method) const =0 |
virtual Description | GetServiceProtocolDescription () const =0 |
virtual bool | HandleServiceProtocolMessage (std::string_view method, const ServiceProtocolMap ¶ms, rapidjson::Document *response)=0 |
virtual size_t | GetResourceCacheLimit ()=0 |
Static Public Member Functions | |
static std::unique_ptr< Shell > | Create (const PlatformData &platform_data, const TaskRunners &task_runners, Settings settings, const CreateCallback< PlatformView > &on_create_platform_view, const CreateCallback< Rasterizer > &on_create_rasterizer, bool is_gpu_disabled=false) |
Creates a shell instance using the provided settings. The callbacks to create the various shell subcomponents will be called on the appropriate threads before this method returns. If this is the first instance of a shell in the process, this call also bootstraps the Dart VM. More... | |
static std::pair< DartVMRef, fml::RefPtr< const DartSnapshot > > | InferVmInitDataFromSettings (Settings &settings) |
Friends | |
class | testing::ShellTest |
Additional Inherited Members | |
Protected Member Functions inherited from flutter::ResourceCacheLimitItem | |
virtual | ~ResourceCacheLimitItem ()=default |
Perhaps the single most important class in the Flutter engine repository. When embedders create a Flutter application, they are referring to the creation of an instance of a shell. Creation and destruction of the shell is synchronous and the embedder only holds a unique pointer to the shell. The shell does not create the threads its primary components run on. Instead, it is the embedder's responsibility to create threads and give the shell task runners for those threads. Due to deterministic destruction of the shell, the embedder can terminate all threads immediately after collecting the shell. The shell must be created and destroyed on the same thread, but, different shells (i.e. a separate instances of a Flutter application) may be run on different threads simultaneously. The task runners themselves do not have to be unique. If all task runner references given to the shell during shell creation point to the same task runner, the Flutter application is effectively single threaded.
The shell is the central nervous system of the Flutter application. None of the shell components are thread safe and must be created, accessed and destroyed on the same thread. To interact with one another, the various components delegate to the shell for communication. Instead of using back pointers to the shell, a delegation pattern is used by all components that want to communicate with one another. Because of this, the shell implements the delegate interface for all these components.
All shell methods accessed by the embedder may only be called on the platform task runner. In case the embedder wants to directly access a shell subcomponent, it is the embedder's responsibility to acquire a weak pointer to that component and post a task to the task runner used by the component to access its methods. The shell must also be destroyed on the platform task runner.
There is no explicit API to bootstrap and shutdown the Dart VM. The first instance of the shell in the process bootstraps the Dart VM and the destruction of the last shell instance destroys the same. Since different shells may be created and destroyed on different threads. VM bootstrap may happen on one thread but its collection on another. This behavior is thread safe.
using flutter::Shell::CreateCallback = std::function<std::unique_ptr<T>(Shell&)> |
typedef std::function<std::unique_ptr<Engine>( Engine::Delegate& delegate, const PointerDataDispatcherMaker& dispatcher_maker, DartVM& vm, fml::RefPtr<const DartSnapshot> isolate_snapshot, TaskRunners task_runners, const PlatformData& platform_data, Settings settings, std::unique_ptr<Animator> animator, fml::WeakPtr<IOManager> io_manager, fml::RefPtr<SkiaUnrefQueue> unref_queue, fml::TaskRunnerAffineWeakPtr<SnapshotDelegate> snapshot_delegate, std::shared_ptr<VolatilePathTracker> volatile_path_tracker, const std::shared_ptr<fml::SyncSwitch>& gpu_disabled_switch, impeller::RuntimeStageBackend runtime_stage_type)> flutter::Shell::EngineCreateCallback |
flutter::Shell::~Shell | ( | ) |
Destroys the shell. This is a synchronous operation and synchronous barrier blocks are introduced on the various threads to ensure shutdown of all shell sub-components before this method returns.
Definition at line 529 of file shell.cc.
|
static |
Creates a shell instance using the provided settings. The callbacks to create the various shell subcomponents will be called on the appropriate threads before this method returns. If this is the first instance of a shell in the process, this call also bootstraps the Dart VM.
[in] | task_runners | The task runners |
[in] | settings | The settings |
[in] | on_create_platform_view | The callback that must return a platform view. This will be called on the platform task runner before this method returns. |
[in] | on_create_rasterizer | That callback that must provide a valid rasterizer. This will be called on the render task runner before this method returns. |
[in] | is_gpu_disabled | The default value for the switch that turns off the GPU. |
Definition at line 169 of file shell.cc.
bool flutter::Shell::EngineHasLivePorts | ( | ) | const |
Used by embedders to check if the Engine is running and has any live ports remaining. For example, the Flutter tester uses this method to check whether it should continue to wait for a running test or not.
Definition at line 717 of file shell.cc.
const std::shared_ptr< fml::ConcurrentTaskRunner > flutter::Shell::GetConcurrentWorkerTaskRunner | ( | ) | const |
Definition at line 2334 of file shell.cc.
DartVM * flutter::Shell::GetDartVM | ( | ) |
fml::WeakPtr< Engine > flutter::Shell::GetEngine | ( | ) |
Engines may only be accessed on the UI thread. This method is deprecated, and implementers should instead use other API available on the Shell or the PlatformView.
fml::WeakPtr< ShellIOManager > flutter::Shell::GetIOManager | ( | ) |
The IO Manager may only be accessed on the IO task runner.
|
overridevirtual |
Accessor for the disable GPU SyncSwitch.
Implements flutter::Rasterizer::Delegate.
Definition at line 2267 of file shell.cc.
double flutter::Shell::GetMainDisplayRefreshRate | ( | ) |
Queries the DisplayManager
for the main display refresh rate.
Definition at line 1871 of file shell.cc.
|
overridevirtual |
Getting the raster thread merger from parent shell, it can be a null RefPtr when it's a root Shell or the embedder_->SupportsDynamicThreadMerging() returns false.
Implements flutter::Rasterizer::Delegate.
Definition at line 809 of file shell.cc.
|
overridevirtual |
Returns the delegate object that handles PlatformMessage's from Flutter to the host platform (and its responses).
Implements flutter::Engine::Delegate.
Definition at line 2322 of file shell.cc.
fml::WeakPtr< PlatformView > flutter::Shell::GetPlatformView | ( | ) |
Platform views may only be accessed on the platform task runner.
fml::TaskRunnerAffineWeakPtr< Rasterizer > flutter::Shell::GetRasterizer | ( | ) | const |
Rasterizers may only be accessed on the raster task runner.
|
overridevirtual |
Implements flutter::Rasterizer::Delegate.
Definition at line 801 of file shell.cc.
|
overridevirtual |
If callers wish to interact directly with any shell subcomponents, they must (on the platform thread) obtain a task runner that the component is designed to run on and a weak pointer to that component. They may then post a task to that task runner, do the validity check on that task runner before performing any operation on that component. This accessor allows callers to access the task runners for this shell.
Implements flutter::Rasterizer::Delegate.
Definition at line 805 of file shell.cc.
std::optional< DartErrorCode > flutter::Shell::GetUIIsolateLastError | ( | ) | const |
Used by embedders to get the last error from the Dart UI Isolate, if one exists.
Definition at line 697 of file shell.cc.
const std::weak_ptr< VsyncWaiter > flutter::Shell::GetVsyncWaiter | ( | ) | const |
|
static |
Definition at line 153 of file shell.cc.
bool flutter::Shell::IsSetup | ( | ) | const |
Used by embedders to check if all shell subcomponents are initialized. It is the embedder's responsibility to make this call before accessing any other shell method. A shell that is not set up must be discarded and another one created with updated settings.
Definition at line 728 of file shell.cc.
void flutter::Shell::NotifyLowMemoryWarning | ( | ) | const |
Used by embedders to notify that there is a low memory warning. The shell will attempt to purge caches. Current, only the rasterizer cache is purged.
Definition at line 637 of file shell.cc.
void flutter::Shell::OnDisplayUpdates | ( | std::vector< std::unique_ptr< Display > > | displays | ) |
Notifies the display manager of the updates.
Definition at line 2297 of file shell.cc.
void flutter::Shell::RegisterImageDecoder | ( | ImageGeneratorFactory | factory, |
int32_t | priority | ||
) |
Install a new factory that can match against and decode image data.
[in] | factory | Callback that produces ImageGenerator s for compatible input data. |
[in] | priority | The priority used to determine the order in which factories are tried. Higher values mean higher priority. The built-in Skia decoders are installed at priority 0, and so a priority > 0 takes precedent over the builtin decoders. When multiple decoders are added with the same priority, those which are added earlier take precedent. |
CreateCompatibleGenerator
Definition at line 1875 of file shell.cc.
bool flutter::Shell::ReloadSystemFonts | ( | ) |
Used by embedders to reload the system fonts in FontCollection. It also clears the cached font families and send system channel message to framework to rebuild affected widgets.
Definition at line 2252 of file shell.cc.
void flutter::Shell::RunEngine | ( | RunConfiguration | run_configuration | ) |
Starts an isolate for the given RunConfiguration.
Definition at line 659 of file shell.cc.
void flutter::Shell::RunEngine | ( | RunConfiguration | run_configuration, |
const std::function< void(Engine::RunStatus)> & | result_callback | ||
) |
Starts an isolate for the given RunConfiguration. The result_callback will be called with the status of the operation.
Definition at line 663 of file shell.cc.
Rasterizer::Screenshot flutter::Shell::Screenshot | ( | Rasterizer::ScreenshotType | type, |
bool | base64_encode | ||
) |
Captures a screenshot and optionally Base64 encodes the data of the last layer tree rendered by the rasterizer in this shell.
[in] | type | The type of screenshot to capture. |
[in] | base64_encode | If the screenshot data should be base64 encoded. |
Definition at line 2189 of file shell.cc.
void flutter::Shell::SetGpuAvailability | ( | GpuAvailability | availability | ) |
Marks the GPU as available or unavailable.
Definition at line 2272 of file shell.cc.
std::unique_ptr< Shell > flutter::Shell::Spawn | ( | RunConfiguration | run_configuration, |
const std::string & | initial_route, | ||
const CreateCallback< PlatformView > & | on_create_platform_view, | ||
const CreateCallback< Rasterizer > & | on_create_rasterizer | ||
) | const |
Creates one Shell from another Shell where the created Shell takes the opportunity to share any internal components it can. This results is a Shell that has a smaller startup time cost and a smaller memory footprint than an Shell created with the Create function.
The new Shell is returned in a running state so RunEngine shouldn't be called again on the Shell. Once running, the second Shell is mostly independent from the original Shell and the original Shell doesn't need to keep running for the spawned Shell to keep functioning.
[in] | run_configuration | A RunConfiguration used to run the Isolate associated with this new Shell. It doesn't have to be the same configuration as the current Shell but it needs to be in the same snapshot or AOT. |
Definition at line 593 of file shell.cc.
fml::Status flutter::Shell::WaitForFirstFrame | ( | fml::TimeDelta | timeout | ) |
Pauses the calling thread until the first frame is presented.
[in] | timeout | The duration to wait before timing out. If this duration would cause an overflow when added to std::chrono::steady_clock::now(), this method will wait indefinitely for the first frame. |
Definition at line 2224 of file shell.cc.
|
friend |