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 [self initWithName:labelPrefix
39  project:projectOrNil
40  allowHeadlessExecution:allowHeadlessExecution
41  restorationEnabled:NO];
42 }
43 
44 - (instancetype)initWithName:(NSString*)labelPrefix
45  project:(FlutterDartProject*)projectOrNil
46  allowHeadlessExecution:(BOOL)allowHeadlessExecution
47  restorationEnabled:(BOOL)restorationEnabled {
48  NSAssert(allowHeadlessExecution == YES,
49  @"Cannot initialize a FlutterHeadlessDartRunner without headless execution.");
50  return [super initWithName:labelPrefix
51  project:projectOrNil
52  allowHeadlessExecution:allowHeadlessExecution
53  restorationEnabled:restorationEnabled];
54 }
55 
56 - (instancetype)init {
57  return [self initWithName:@"io.flutter.headless" project:nil];
58 }
59 @end
int BOOL
Definition: windows_types.h:37