Removed callback for HeadlessDartRunner (flutter/engine#5983)

This commit is contained in:
Ben Konyi
2018-08-09 11:21:51 -07:00
committed by GitHub
parent caa739319e
commit b5aa93de7c
2 changed files with 3 additions and 14 deletions

View File

@@ -45,12 +45,8 @@ FLUTTER_EXPORT
- Parameter entrypoint: The name of a top-level function from a Dart library.
- Parameter uri: The URI of the Dart library which contains entrypoint.
- Parameter callback: The callback to be invoked when the new Isolate is
invoked.
*/
- (void)runWithEntrypointAndCallback:(NSString*)entrypoint
libraryUri:(NSString*)uri
completion:(FlutterHeadlessDartRunnerCallback)callback;
- (void)runWithEntrypointAndLibraryUri:(NSString*)entrypoint libraryUri:(NSString*)uri;
@end

View File

@@ -47,9 +47,7 @@ static std::string CreateShellLabel() {
std::unique_ptr<shell::Shell> _shell;
}
- (void)runWithEntrypointAndCallback:(NSString*)entrypoint
libraryUri:(NSString*)uri
completion:(FlutterHeadlessDartRunnerCallback)callback {
- (void)runWithEntrypointAndLibraryUri:(NSString*)entrypoint libraryUri:(NSString*)uri {
if (_shell != nullptr || entrypoint.length == 0) {
FML_LOG(ERROR) << "This headless dart runner was already used to run some code.";
return;
@@ -100,8 +98,7 @@ static std::string CreateShellLabel() {
// Override the default run configuration with the specified entrypoint.
_shell->GetTaskRunners().GetUITaskRunner()->PostTask(
fml::MakeCopyable([engine = _shell->GetEngine(), config = std::move(config),
callback = Block_copy(callback)]() mutable {
fml::MakeCopyable([engine = _shell->GetEngine(), config = std::move(config)]() mutable {
BOOL success = NO;
FML_LOG(INFO) << "Attempting to launch background engine configuration...";
if (!engine || !engine->Run(std::move(config))) {
@@ -110,10 +107,6 @@ static std::string CreateShellLabel() {
FML_LOG(INFO) << "Background Isolate successfully started and run.";
success = YES;
}
if (callback != nil) {
callback(success);
Block_release(callback);
}
}));
}