Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/public/app/content_main.h" | 5 #include "content/public/app/content_main.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include "content/app/content_service_manager_main_delegate.h" |
| 8 | 8 #include "services/service_manager/embedder/main.h" |
| 9 #include "base/debug/activity_tracker.h" | |
| 10 #include "content/public/app/content_main_runner.h" | |
| 11 | 9 |
| 12 namespace content { | 10 namespace content { |
| 13 | 11 |
| 14 int ContentMain(const ContentMainParams& params) { | 12 int ContentMain(const ContentMainParams& params) { |
| 15 std::unique_ptr<ContentMainRunner> main_runner(ContentMainRunner::Create()); | 13 ContentServiceManagerMainDelegate delegate(params); |
| 16 | 14 service_manager::MainParams main_params(&delegate); |
| 17 int exit_code = main_runner->Initialize(params); | 15 #if defined(OS_POSIX) && !defined(OS_ANDROID) |
| 18 if (exit_code >= 0) { | 16 main_params.argc = params.argc; |
| 19 base::debug::GlobalActivityTracker* tracker = | 17 main_params.argv = params.argv; |
|
Ken Rockot(use gerrit already)
2017/03/20 17:27:06
nit: This GlobalActivityTracker stuff is new since
| |
| 20 base::debug::GlobalActivityTracker::Get(); | 18 #endif |
| 21 if (tracker) { | 19 return service_manager::Main(main_params); |
| 22 tracker->SetProcessPhase( | |
| 23 base::debug::GlobalActivityTracker::PROCESS_LAUNCH_FAILED); | |
| 24 tracker->process_data().SetInt("exit-code", exit_code); | |
| 25 } | |
| 26 return exit_code; | |
| 27 } | |
| 28 | |
| 29 exit_code = main_runner->Run(); | |
| 30 | |
| 31 main_runner->Shutdown(); | |
| 32 | |
| 33 base::debug::GlobalActivityTracker* tracker = | |
| 34 base::debug::GlobalActivityTracker::Get(); | |
| 35 if (tracker) { | |
| 36 if (exit_code == 0) { | |
| 37 tracker->SetProcessPhaseIfEnabled( | |
| 38 base::debug::GlobalActivityTracker::PROCESS_EXITED_CLEANLY); | |
| 39 } else { | |
| 40 tracker->SetProcessPhaseIfEnabled( | |
| 41 base::debug::GlobalActivityTracker::PROCESS_EXITED_WITH_CODE); | |
| 42 tracker->process_data().SetInt("exit-code", exit_code); | |
| 43 } | |
| 44 } | |
| 45 | |
| 46 return exit_code; | |
| 47 } | 20 } |
| 48 | 21 |
| 49 } // namespace content | 22 } // namespace content |
| OLD | NEW |