Flutter Engine
FlutterHeadlessDartRunner.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 #define FML_USED_ON_EMBEDDER
6 
7 #import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterHeadlessDartRunner.h"
8 
9 #include <memory>
10 
11 #include "flutter/fml/make_copyable.h"
12 #include "flutter/fml/message_loop.h"
13 #include "flutter/shell/common/engine.h"
14 #include "flutter/shell/common/rasterizer.h"
15 #include "flutter/shell/common/run_configuration.h"
16 #include "flutter/shell/common/shell.h"
17 #include "flutter/shell/common/switches.h"
18 #include "flutter/shell/common/thread_host.h"
19 #import "flutter/shell/platform/darwin/common/command_line.h"
20 #import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h"
21 #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h"
22 #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine_Internal.h"
23 #import "flutter/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.h"
24 #import "flutter/shell/platform/darwin/ios/platform_view_ios.h"
25 
26 @implementation FlutterHeadlessDartRunner {
27 }
28 
29 - (instancetype)initWithName:(NSString*)labelPrefix project:(FlutterDartProject*)projectOrNil {
30  return [self initWithName:labelPrefix project:projectOrNil allowHeadlessExecution:YES];
31 }
32 
33 - (instancetype)initWithName:(NSString*)labelPrefix
34  project:(FlutterDartProject*)projectOrNil
35  allowHeadlessExecution:(BOOL)allowHeadlessExecution {
36  NSAssert(allowHeadlessExecution == YES,
37  @"Cannot initialize a FlutterHeadlessDartRunner without headless execution.");
38  return [super initWithName:labelPrefix
39  project:projectOrNil
40  allowHeadlessExecution:allowHeadlessExecution];
41 }
42 - (instancetype)init {
43  return [self initWithName:@"io.flutter.headless" project:nil];
44 }
45 @end