| 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 <memory> |
| 8 | 8 |
| 9 #include "base/debug/activity_tracker.h" |
| 9 #include "content/public/app/content_main_runner.h" | 10 #include "content/public/app/content_main_runner.h" |
| 10 | 11 |
| 11 namespace content { | 12 namespace content { |
| 12 | 13 |
| 13 int ContentMain(const ContentMainParams& params) { | 14 int ContentMain(const ContentMainParams& params) { |
| 14 std::unique_ptr<ContentMainRunner> main_runner(ContentMainRunner::Create()); | 15 std::unique_ptr<ContentMainRunner> main_runner(ContentMainRunner::Create()); |
| 15 | 16 |
| 16 int exit_code = main_runner->Initialize(params); | 17 int exit_code = main_runner->Initialize(params); |
| 17 if (exit_code >= 0) | 18 if (exit_code >= 0) { |
| 19 base::debug::GlobalActivityTracker* tracker = |
| 20 base::debug::GlobalActivityTracker::Get(); |
| 21 if (tracker) { |
| 22 tracker->SetProcessPhase( |
| 23 base::debug::GlobalActivityTracker::PROCESS_LAUNCH_FAILED); |
| 24 tracker->process_data().SetInt("exit-code", exit_code); |
| 25 } |
| 18 return exit_code; | 26 return exit_code; |
| 27 } |
| 19 | 28 |
| 20 exit_code = main_runner->Run(); | 29 exit_code = main_runner->Run(); |
| 21 | 30 |
| 22 main_runner->Shutdown(); | 31 main_runner->Shutdown(); |
| 23 | 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 |
| 24 return exit_code; | 46 return exit_code; |
| 25 } | 47 } |
| 26 | 48 |
| 27 } // namespace content | 49 } // namespace content |
| OLD | NEW |