Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
George Wright committed Oct 26, 2020
1 parent b174d63 commit 0039682
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
3 changes: 2 additions & 1 deletion shell/platform/windows/client_wrapper/flutter_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ FlutterEngine::FlutterEngine(const DartProject& project) {
std::back_inserter(entrypoint_argv),
[](const std::string& arg) -> const char* { return arg.c_str(); });

c_engine_properties.dart_entrypoint_argc = static_cast<int>(entrypoint_argv.size());
c_engine_properties.dart_entrypoint_argc =
static_cast<int>(entrypoint_argv.size());
c_engine_properties.dart_entrypoint_argv =
entrypoint_argv.size() > 0 ? entrypoint_argv.data() : nullptr;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ class TestFlutterWindowsApi : public testing::StubFlutterWindowsApi {

bool reload_fonts_called() { return reload_fonts_called_; }

FlutterDesktopEngineProperties& engine_properties() { return engine_properties_; }
FlutterDesktopEngineProperties& engine_properties() {
return engine_properties_;
}

private:
bool create_called_ = false;
Expand Down Expand Up @@ -136,8 +138,10 @@ TEST(FlutterEngineTest, DartEntrypointArgs) {
auto test_api = static_cast<TestFlutterWindowsApi*>(scoped_api_stub.stub());

FlutterEngine engine(project);
EXPECT_TRUE(arguments[0] == test_api->engine_properties().dart_entrypoint_argv[0]);
EXPECT_TRUE(arguments[1] == test_api->engine_properties().dart_entrypoint_argv[1]);
EXPECT_TRUE(arguments[0] ==
test_api->engine_properties().dart_entrypoint_argv[0]);
EXPECT_TRUE(arguments[1] ==
test_api->engine_properties().dart_entrypoint_argv[1]);
EXPECT_EQ(2, test_api->engine_properties().dart_entrypoint_argc);
}

Expand Down
3 changes: 2 additions & 1 deletion shell/platform/windows/flutter_project_bundle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ FlutterProjectBundle::FlutterProjectBundle(
}

for (int i = 0; i < properties.dart_entrypoint_argc; i++) {
dart_entrypoint_arguments_.push_back(std::string(properties.dart_entrypoint_argv[i]));
dart_entrypoint_arguments_.push_back(
std::string(properties.dart_entrypoint_argv[i]));
}

// Resolve any relative paths.
Expand Down
7 changes: 5 additions & 2 deletions shell/platform/windows/flutter_project_bundle.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ class FlutterProjectBundle {
// Logs and returns nullptr on failure.
UniqueAotDataPtr LoadAotData();

// Returns the command line arguments to be passed through to the Dart entrypoint.
const std::vector<std::string>& dart_entrypoint_arguments() const { return dart_entrypoint_arguments_; }
// Returns the command line arguments to be passed through to the Dart
// entrypoint.
const std::vector<std::string>& dart_entrypoint_arguments() const {
return dart_entrypoint_arguments_;
}

private:
std::filesystem::path assets_path_;
Expand Down
9 changes: 6 additions & 3 deletions shell/platform/windows/flutter_windows_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,12 @@ bool FlutterWindowsEngine::RunWithEntrypoint(const char* entrypoint) {
switches.begin(), switches.end(), std::back_inserter(argv),
[](const std::string& arg) -> const char* { return arg.c_str(); });

const std::vector<std::string>& entrypoint_args = project_->dart_entrypoint_arguments();
const std::vector<std::string>& entrypoint_args =
project_->dart_entrypoint_arguments();
std::vector<const char*> entrypoint_argv;
std::transform(
entrypoint_args.begin(), entrypoint_args.end(), std::back_inserter(entrypoint_argv),
entrypoint_args.begin(), entrypoint_args.end(),
std::back_inserter(entrypoint_argv),
[](const std::string& arg) -> const char* { return arg.c_str(); });

// Configure task runners.
Expand All @@ -173,7 +175,8 @@ bool FlutterWindowsEngine::RunWithEntrypoint(const char* entrypoint) {
args.command_line_argc = static_cast<int>(argv.size());
args.command_line_argv = argv.size() > 0 ? argv.data() : nullptr;
args.dart_entrypoint_argc = static_cast<int>(entrypoint_argv.size());
args.dart_entrypoint_argv = entrypoint_argv.size() > 0 ? entrypoint_argv.data() : nullptr;
args.dart_entrypoint_argv =
entrypoint_argv.size() > 0 ? entrypoint_argv.data() : nullptr;
args.platform_message_callback =
[](const FlutterPlatformMessage* engine_message,
void* user_data) -> void {
Expand Down

0 comments on commit 0039682

Please sign in to comment.