Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-land "Support multiple shells in a single process. (#4932)" #4998

Merged
merged 3 commits into from
Apr 13, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Launch the engine synchronously.
  • Loading branch information
chinmaygarde committed Apr 13, 2018
commit bad8cc93aafbb65f8e93baac4bbb8b06e22f4fbb
13 changes: 10 additions & 3 deletions shell/testing/tester_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "flutter/fml/file.h"
#include "flutter/fml/message_loop.h"
#include "flutter/fml/paths.h"
#include "flutter/fml/task_runner.h"
#include "flutter/shell/common/platform_view.h"
#include "flutter/shell/common/rasterizer.h"
#include "flutter/shell/common/shell.h"
Expand Down Expand Up @@ -152,9 +153,13 @@ int RunTester(const blink::Settings& settings, bool run_forever) {

bool engine_did_run = false;

shell->GetTaskRunners().GetUITaskRunner()->PostTask(fxl::MakeCopyable(
[&completion_observer, engine = shell->GetEngine(),
config = std::move(run_configuration), &engine_did_run]() mutable {
fxl::AutoResetWaitableEvent sync_run_latch;
fml::TaskRunner::RunNowOrPostTask(
shell->GetTaskRunners().GetUITaskRunner(),
fxl::MakeCopyable([&sync_run_latch, &completion_observer,
engine = shell->GetEngine(),
config = std::move(run_configuration),
&engine_did_run]() mutable {
fml::MessageLoop::GetCurrent().AddTaskObserver(
reinterpret_cast<intptr_t>(&completion_observer),
[&completion_observer]() { completion_observer.DidProcessTask(); });
Expand All @@ -170,7 +175,9 @@ int RunTester(const blink::Settings& settings, bool run_forever) {
} else {
FXL_DLOG(ERROR) << "Could not launch the engine with configuration.";
}
sync_run_latch.Signal();
}));
sync_run_latch.Wait();

// Run the message loop and wait for the script to do its thing.
fml::MessageLoop::GetCurrent().Run();
Expand Down