Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Instance Methods | Class Methods | Properties | List of all members
FlutterDartVMServicePublisher Class Reference

#include <FlutterDartVMServicePublisher.h>

Inheritance diagram for FlutterDartVMServicePublisher:

Instance Methods

(instancetype) - initWithEnableVMServicePublication:
 
(instancetype) - NS_UNAVAILABLE
 
(void) - dealloc [implementation]
 

Class Methods

(instancetype) + NS_UNAVAILABLE
 
(NSString *) + serviceName [implementation]
 
(NSData *) + createTxtData: [implementation]
 

Properties

NSURL * url
 
NSObject< FlutterDartVMServicePublisherDelegate > * delegate [implementation]
 
BOOL enableVMServicePublication [implementation]
 

Detailed Description

Definition at line 10 of file FlutterDartVMServicePublisher.h.

Method Documentation

◆ createTxtData:

+ (NSData *) createTxtData: (NSURL*)  url
implementation

Definition at line 120 of file FlutterDartVMServicePublisher.mm.

182 :(NSURL*)url {
183 // Check to see if there's an authentication code. If there is, we'll provide
184 // it as a txt record so flutter tools can establish a connection.
185 NSString* path = [[url path] substringFromIndex:MIN(1, [[url path] length])];
186 NSData* pathData = [path dataUsingEncoding:NSUTF8StringEncoding];
187 NSDictionary<NSString*, NSData*>* txtDict = @{
188 @"authCode" : pathData,
189 };
190 return [NSNetService dataFromTXTRecordDictionary:txtDict];
191}
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition switches.h:57

◆ dealloc

- (void) dealloc
implementation

Definition at line 120 of file FlutterDartVMServicePublisher.mm.

193 {
194 [_delegate stopService];
195
197}
static bool RemoveServerStatusCallback(CallbackHandle handle)
Removed a callback previously registered via AddServiceStatusCallback.

◆ initWithEnableVMServicePublication:

- (instancetype) initWithEnableVMServicePublication: (BOOL NS_DESIGNATED_INITIALIZER
Initial value:

Definition at line 120 of file FlutterDartVMServicePublisher.mm.

146 :(BOOL)enableVMServicePublication {
147 self = [super init];
148 NSAssert(self, @"Super must not return null on init.");
149
150 _delegate = [[DartVMServiceDNSServiceDelegate alloc] init];
151 _enableVMServicePublication = enableVMServicePublication;
152 __weak __typeof(self) weakSelf = self;
153
154 fml::MessageLoop::EnsureInitializedForCurrentThread();
155
156 _callbackHandle = flutter::DartServiceIsolate::AddServerStatusCallback(
157 [weakSelf, runner = fml::MessageLoop::GetCurrent().GetTaskRunner()](const std::string& uri) {
158 if (!uri.empty()) {
159 runner->PostTask([weakSelf, uri]() {
160 FlutterDartVMServicePublisher* strongSelf = weakSelf;
161 // uri comes in as something like 'http://127.0.0.1:XXXXX/' where XXXXX is the port
162 // number.
163 if (strongSelf) {
164 NSURL* url =
165 [[NSURL alloc] initWithString:[NSString stringWithUTF8String:uri.c_str()]];
166 strongSelf.url = url;
167 if (strongSelf.enableVMServicePublication) {
168 [[strongSelf delegate] publishServiceProtocolPort:url];
169 }
170 }
171 });
172 }
173 });
174
175 return self;
176}
Definition ref_ptr.h:256
int BOOL

◆ NS_UNAVAILABLE [1/2]

- (instancetype) NS_UNAVAILABLE

◆ NS_UNAVAILABLE [2/2]

+ (instancetype) NS_UNAVAILABLE

◆ serviceName

+ (NSString *) serviceName
implementation

Definition at line 120 of file FlutterDartVMServicePublisher.mm.

178 {
179 return NSBundle.mainBundle.bundleIdentifier;
180}

Property Documentation

◆ delegate

- (NSObject<FlutterDartVMServicePublisherDelegate>*) delegate
readatomicassignimplementation

Provided by category FlutterDartVMServicePublisher().

Definition at line 59 of file FlutterDartVMServicePublisher.mm.

◆ enableVMServicePublication

- (BOOL) enableVMServicePublication
readatomicassignimplementation

Provided by category FlutterDartVMServicePublisher().

Definition at line 61 of file FlutterDartVMServicePublisher.mm.

◆ url

- (NSURL*) url
readnonatomicassign

Definition at line 17 of file FlutterDartVMServicePublisher.h.


The documentation for this class was generated from the following files: