| 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 | 8 |
| 9 #include "base/allocator/allocator_extension.h" | 9 #include "base/allocator/allocator_extension.h" |
| 10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 // TRACE_EVENT methods on Linux or iOS builds till after we set this up. | 571 // TRACE_EVENT methods on Linux or iOS builds till after we set this up. |
| 572 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 572 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 573 if (!ui_task_) { | 573 if (!ui_task_) { |
| 574 // When running browser tests, don't create a second AtExitManager as that | 574 // When running browser tests, don't create a second AtExitManager as that |
| 575 // interfers with shutdown when objects created before ContentMain is | 575 // interfers with shutdown when objects created before ContentMain is |
| 576 // called are destructed when it returns. | 576 // called are destructed when it returns. |
| 577 exit_manager_.reset(new base::AtExitManager); | 577 exit_manager_.reset(new base::AtExitManager); |
| 578 } | 578 } |
| 579 #endif // !OS_ANDROID && !OS_IOS | 579 #endif // !OS_ANDROID && !OS_IOS |
| 580 | 580 |
| 581 #if defined(OS_MACOSX) | 581 // Don't create this loop on iOS, since the outer loop is already handled |
| 582 // and a loop that's destroyed in shutdown interleaves badly with the event |
| 583 // loop pool on iOS. |
| 584 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 582 // We need this pool for all the objects created before we get to the | 585 // We need this pool for all the objects created before we get to the |
| 583 // event loop, but we don't want to leave them hanging around until the | 586 // event loop, but we don't want to leave them hanging around until the |
| 584 // app quits. Each "main" needs to flush this pool right before it goes into | 587 // app quits. Each "main" needs to flush this pool right before it goes into |
| 585 // its main event loop to get rid of the cruft. | 588 // its main event loop to get rid of the cruft. |
| 586 autorelease_pool_.reset(new base::mac::ScopedNSAutoreleasePool()); | 589 autorelease_pool_.reset(new base::mac::ScopedNSAutoreleasePool()); |
| 587 #endif | 590 #endif |
| 588 | 591 |
| 589 // On Android, the command line is initialized when library is loaded and | 592 // On Android, the command line is initialized when library is loaded and |
| 590 // we have already started our TRACE_EVENT0. | 593 // we have already started our TRACE_EVENT0. |
| 591 #if !defined(OS_ANDROID) | 594 #if !defined(OS_ANDROID) |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 | 818 |
| 816 delegate_->ProcessExiting(process_type); | 819 delegate_->ProcessExiting(process_type); |
| 817 } | 820 } |
| 818 | 821 |
| 819 #if defined(OS_WIN) | 822 #if defined(OS_WIN) |
| 820 #ifdef _CRTDBG_MAP_ALLOC | 823 #ifdef _CRTDBG_MAP_ALLOC |
| 821 _CrtDumpMemoryLeaks(); | 824 _CrtDumpMemoryLeaks(); |
| 822 #endif // _CRTDBG_MAP_ALLOC | 825 #endif // _CRTDBG_MAP_ALLOC |
| 823 #endif // OS_WIN | 826 #endif // OS_WIN |
| 824 | 827 |
| 825 #if defined(OS_MACOSX) | 828 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 826 autorelease_pool_.reset(NULL); | 829 autorelease_pool_.reset(NULL); |
| 827 #endif | 830 #endif |
| 828 | 831 |
| 829 exit_manager_.reset(NULL); | 832 exit_manager_.reset(NULL); |
| 830 | 833 |
| 831 delegate_ = NULL; | 834 delegate_ = NULL; |
| 832 is_shutdown_ = true; | 835 is_shutdown_ = true; |
| 833 } | 836 } |
| 834 | 837 |
| 835 private: | 838 private: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 859 | 862 |
| 860 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 863 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
| 861 }; | 864 }; |
| 862 | 865 |
| 863 // static | 866 // static |
| 864 ContentMainRunner* ContentMainRunner::Create() { | 867 ContentMainRunner* ContentMainRunner::Create() { |
| 865 return new ContentMainRunnerImpl(); | 868 return new ContentMainRunnerImpl(); |
| 866 } | 869 } |
| 867 | 870 |
| 868 } // namespace content | 871 } // namespace content |
| OLD | NEW |