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_runner.h" | 5 #include "content/public/app/content_main_runner.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <sys/types.h> |
| 9 #include <sys/wait.h> |
| 10 #if defined(OS_POSIX) |
| 11 #include <errno.h> |
| 12 #endif // OS_POSIX |
| 13 |
8 | 14 |
9 #include "base/allocator/allocator_extension.h" | 15 #include "base/allocator/allocator_extension.h" |
10 #include "base/at_exit.h" | 16 #include "base/at_exit.h" |
11 #include "base/command_line.h" | 17 #include "base/command_line.h" |
12 #include "base/debug/debugger.h" | 18 #include "base/debug/debugger.h" |
13 #include "base/debug/trace_event.h" | 19 #include "base/debug/trace_event.h" |
14 #include "base/files/file_path.h" | 20 #include "base/files/file_path.h" |
15 #include "base/i18n/icu_util.h" | 21 #include "base/i18n/icu_util.h" |
16 #include "base/lazy_instance.h" | 22 #include "base/lazy_instance.h" |
17 #include "base/logging.h" | 23 #include "base/logging.h" |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 | 785 |
780 _Module.Term(); | 786 _Module.Term(); |
781 #endif // OS_WIN | 787 #endif // OS_WIN |
782 | 788 |
783 #if defined(OS_MACOSX) | 789 #if defined(OS_MACOSX) |
784 autorelease_pool_.reset(NULL); | 790 autorelease_pool_.reset(NULL); |
785 #endif | 791 #endif |
786 | 792 |
787 exit_manager_.reset(NULL); | 793 exit_manager_.reset(NULL); |
788 | 794 |
| 795 #if defined(OS_POSIX) |
| 796 // Wait for children to exit if --wait-for-children-before-exiting is |
| 797 // passed. |
| 798 if (CommandLine::ForCurrentProcess()-> |
| 799 HasSwitch(switches::kWaitForChildrenBeforeExiting)) { |
| 800 for (;;) { |
| 801 if (wait(NULL) < 0 && errno == ECHILD) |
| 802 break; |
| 803 } |
| 804 } |
| 805 #endif // OS_POSIX |
| 806 |
789 delegate_ = NULL; | 807 delegate_ = NULL; |
790 is_shutdown_ = true; | 808 is_shutdown_ = true; |
791 } | 809 } |
792 | 810 |
793 private: | 811 private: |
794 // True if the runner has been initialized. | 812 // True if the runner has been initialized. |
795 bool is_initialized_; | 813 bool is_initialized_; |
796 | 814 |
797 // True if the runner has been shut down. | 815 // True if the runner has been shut down. |
798 bool is_shutdown_; | 816 bool is_shutdown_; |
(...skipping 16 matching lines...) Expand all Loading... |
815 | 833 |
816 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 834 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
817 }; | 835 }; |
818 | 836 |
819 // static | 837 // static |
820 ContentMainRunner* ContentMainRunner::Create() { | 838 ContentMainRunner* ContentMainRunner::Create() { |
821 return new ContentMainRunnerImpl(); | 839 return new ContentMainRunnerImpl(); |
822 } | 840 } |
823 | 841 |
824 } // namespace content | 842 } // namespace content |
OLD | NEW |