Commit ec6d20ec authored by gunsch's avatar gunsch Committed by Commit bot

Chromecast: moves all service startup code to PreMainMessageLoopRun.

On Android, CastService::Start is never called (!). This is because
Android uses a Java-based UI message loop after
BrowserMainRunner::Initialize is completed, and BrowserMainRunner:Run is
never called (nor should it be).

See ChromeBrowserMainParts for similar handling of the Android case.

R=lcwu@chromium.org,byungchul@chromium.org
BUG=internal b/18934906

Review URL: https://codereview.chromium.org/953283002

Cr-Commit-Position: refs/heads/master@{#318136}
parent 13d97085
......@@ -44,6 +44,7 @@
namespace {
#if !defined(OS_ANDROID)
int kSignalsToRunClosure[] = { SIGTERM, SIGINT, };
// Closure to run on SIGTERM and SIGINT.
......@@ -82,6 +83,7 @@ void RegisterClosureOnSignal(const base::Closure& closure) {
// Get the first signal to exit when the parent process dies.
prctl(PR_SET_PDEATHSIG, kSignalsToRunClosure[0]);
}
#endif // !defined(OS_ANDROID)
} // namespace
......@@ -245,11 +247,16 @@ void CastBrowserMainParts::PreMainMessageLoopRun() {
cast_browser_process_->metrics_service_client()
->Initialize(cast_browser_process_->cast_service());
url_request_context_factory_->InitializeNetworkDelegates();
}
bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) {
cast_browser_process_->cast_service()->Start();
}
bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) {
#if defined(OS_ANDROID)
// Android does not use native main MessageLoop.
NOTREACHED();
return true;
#else
base::RunLoop run_loop;
base::Closure quit_closure(run_loop.QuitClosure());
RegisterClosureOnSignal(quit_closure);
......@@ -265,12 +272,18 @@ bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) {
cast_browser_process_->cast_service()->Stop();
return true;
#endif
}
void CastBrowserMainParts::PostMainMessageLoopRun() {
#if defined(OS_ANDROID)
// Android does not use native main MessageLoop.
NOTREACHED();
#else
cast_browser_process_->cast_service()->Finalize();
cast_browser_process_->metrics_service_client()->Finalize();
cast_browser_process_.reset();
#endif
}
} // namespace shell
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment