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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <string.h> | 9 #include <string.h> |
10 | 10 |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 } | 446 } |
447 | 447 |
448 ~ContentMainRunnerImpl() override { | 448 ~ContentMainRunnerImpl() override { |
449 if (is_initialized_ && !is_shutdown_) | 449 if (is_initialized_ && !is_shutdown_) |
450 Shutdown(); | 450 Shutdown(); |
451 } | 451 } |
452 | 452 |
453 int Initialize(const ContentMainParams& params) override { | 453 int Initialize(const ContentMainParams& params) override { |
454 ui_task_ = params.ui_task; | 454 ui_task_ = params.ui_task; |
455 | 455 |
| 456 #if defined(USE_AURA) |
| 457 env_mode_ = params.env_mode; |
| 458 #endif |
| 459 |
456 base::EnableTerminationOnOutOfMemory(); | 460 base::EnableTerminationOnOutOfMemory(); |
457 #if defined(OS_WIN) | 461 #if defined(OS_WIN) |
458 base::win::RegisterInvalidParamHandler(); | 462 base::win::RegisterInvalidParamHandler(); |
459 ui::win::CreateATLModuleIfNeeded(); | 463 ui::win::CreateATLModuleIfNeeded(); |
460 | 464 |
461 sandbox_info_ = *params.sandbox_info; | 465 sandbox_info_ = *params.sandbox_info; |
462 #else // !OS_WIN | 466 #else // !OS_WIN |
463 | 467 |
464 #if defined(OS_ANDROID) | 468 #if defined(OS_ANDROID) |
465 // See note at the initialization of ExitManager, below; basically, | 469 // See note at the initialization of ExitManager, below; basically, |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 | 779 |
776 base::HistogramBase::EnableActivityReportHistogram(process_type); | 780 base::HistogramBase::EnableActivityReportHistogram(process_type); |
777 | 781 |
778 MainFunctionParams main_params(command_line); | 782 MainFunctionParams main_params(command_line); |
779 main_params.ui_task = ui_task_; | 783 main_params.ui_task = ui_task_; |
780 #if defined(OS_WIN) | 784 #if defined(OS_WIN) |
781 main_params.sandbox_info = &sandbox_info_; | 785 main_params.sandbox_info = &sandbox_info_; |
782 #elif defined(OS_MACOSX) | 786 #elif defined(OS_MACOSX) |
783 main_params.autorelease_pool = autorelease_pool_.get(); | 787 main_params.autorelease_pool = autorelease_pool_.get(); |
784 #endif | 788 #endif |
| 789 #if defined(USE_AURA) |
| 790 main_params.env_mode = env_mode_; |
| 791 #endif |
785 | 792 |
786 return RunNamedProcessTypeMain(process_type, main_params, delegate_); | 793 return RunNamedProcessTypeMain(process_type, main_params, delegate_); |
787 } | 794 } |
788 | 795 |
789 void Shutdown() override { | 796 void Shutdown() override { |
790 DCHECK(is_initialized_); | 797 DCHECK(is_initialized_); |
791 DCHECK(!is_shutdown_); | 798 DCHECK(!is_shutdown_); |
792 | 799 |
793 if (completed_basic_startup_ && delegate_) { | 800 if (completed_basic_startup_ && delegate_) { |
794 const base::CommandLine& command_line = | 801 const base::CommandLine& command_line = |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 | 840 |
834 std::unique_ptr<base::AtExitManager> exit_manager_; | 841 std::unique_ptr<base::AtExitManager> exit_manager_; |
835 #if defined(OS_WIN) | 842 #if defined(OS_WIN) |
836 sandbox::SandboxInterfaceInfo sandbox_info_; | 843 sandbox::SandboxInterfaceInfo sandbox_info_; |
837 #elif defined(OS_MACOSX) | 844 #elif defined(OS_MACOSX) |
838 std::unique_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool_; | 845 std::unique_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool_; |
839 #endif | 846 #endif |
840 | 847 |
841 base::Closure* ui_task_; | 848 base::Closure* ui_task_; |
842 | 849 |
| 850 #if defined(USE_AURA) |
| 851 aura::Env::Mode env_mode_ = aura::Env::Mode::LOCAL; |
| 852 #endif |
| 853 |
843 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 854 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
844 }; | 855 }; |
845 | 856 |
846 // static | 857 // static |
847 ContentMainRunner* ContentMainRunner::Create() { | 858 ContentMainRunner* ContentMainRunner::Create() { |
848 return new ContentMainRunnerImpl(); | 859 return new ContentMainRunnerImpl(); |
849 } | 860 } |
850 | 861 |
851 } // namespace content | 862 } // namespace content |
OLD | NEW |