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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 | 473 |
474 static void GetStatsThunk(char* buffer, int buffer_length) { | 474 static void GetStatsThunk(char* buffer, int buffer_length) { |
475 MallocExtension::instance()->GetStats(buffer, buffer_length); | 475 MallocExtension::instance()->GetStats(buffer, buffer_length); |
476 } | 476 } |
477 | 477 |
478 static void ReleaseFreeMemoryThunk() { | 478 static void ReleaseFreeMemoryThunk() { |
479 MallocExtension::instance()->ReleaseFreeMemory(); | 479 MallocExtension::instance()->ReleaseFreeMemory(); |
480 } | 480 } |
481 #endif | 481 #endif |
482 | 482 |
483 virtual int Initialize(const ContentMainParams& params) OVERRIDE { | 483 virtual int Initialize(const ContentMainParams& params) override { |
484 ui_task_ = params.ui_task; | 484 ui_task_ = params.ui_task; |
485 | 485 |
486 #if defined(OS_WIN) | 486 #if defined(OS_WIN) |
487 RegisterInvalidParamHandler(); | 487 RegisterInvalidParamHandler(); |
488 ui::win::CreateATLModuleIfNeeded(); | 488 ui::win::CreateATLModuleIfNeeded(); |
489 | 489 |
490 sandbox_info_ = *params.sandbox_info; | 490 sandbox_info_ = *params.sandbox_info; |
491 #else // !OS_WIN | 491 #else // !OS_WIN |
492 | 492 |
493 #if defined(OS_ANDROID) | 493 #if defined(OS_ANDROID) |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 } | 742 } |
743 #endif | 743 #endif |
744 | 744 |
745 if (delegate_) | 745 if (delegate_) |
746 delegate_->SandboxInitialized(process_type); | 746 delegate_->SandboxInitialized(process_type); |
747 | 747 |
748 // Return -1 to indicate no early termination. | 748 // Return -1 to indicate no early termination. |
749 return -1; | 749 return -1; |
750 } | 750 } |
751 | 751 |
752 virtual int Run() OVERRIDE { | 752 virtual int Run() override { |
753 DCHECK(is_initialized_); | 753 DCHECK(is_initialized_); |
754 DCHECK(!is_shutdown_); | 754 DCHECK(!is_shutdown_); |
755 const base::CommandLine& command_line = | 755 const base::CommandLine& command_line = |
756 *base::CommandLine::ForCurrentProcess(); | 756 *base::CommandLine::ForCurrentProcess(); |
757 std::string process_type = | 757 std::string process_type = |
758 command_line.GetSwitchValueASCII(switches::kProcessType); | 758 command_line.GetSwitchValueASCII(switches::kProcessType); |
759 | 759 |
760 MainFunctionParams main_params(command_line); | 760 MainFunctionParams main_params(command_line); |
761 main_params.ui_task = ui_task_; | 761 main_params.ui_task = ui_task_; |
762 #if defined(OS_WIN) | 762 #if defined(OS_WIN) |
763 main_params.sandbox_info = &sandbox_info_; | 763 main_params.sandbox_info = &sandbox_info_; |
764 #elif defined(OS_MACOSX) | 764 #elif defined(OS_MACOSX) |
765 main_params.autorelease_pool = autorelease_pool_.get(); | 765 main_params.autorelease_pool = autorelease_pool_.get(); |
766 #endif | 766 #endif |
767 | 767 |
768 #if !defined(OS_IOS) | 768 #if !defined(OS_IOS) |
769 return RunNamedProcessTypeMain(process_type, main_params, delegate_); | 769 return RunNamedProcessTypeMain(process_type, main_params, delegate_); |
770 #else | 770 #else |
771 return 1; | 771 return 1; |
772 #endif | 772 #endif |
773 } | 773 } |
774 | 774 |
775 virtual void Shutdown() OVERRIDE { | 775 virtual void Shutdown() override { |
776 DCHECK(is_initialized_); | 776 DCHECK(is_initialized_); |
777 DCHECK(!is_shutdown_); | 777 DCHECK(!is_shutdown_); |
778 | 778 |
779 if (completed_basic_startup_ && delegate_) { | 779 if (completed_basic_startup_ && delegate_) { |
780 const base::CommandLine& command_line = | 780 const base::CommandLine& command_line = |
781 *base::CommandLine::ForCurrentProcess(); | 781 *base::CommandLine::ForCurrentProcess(); |
782 std::string process_type = | 782 std::string process_type = |
783 command_line.GetSwitchValueASCII(switches::kProcessType); | 783 command_line.GetSwitchValueASCII(switches::kProcessType); |
784 | 784 |
785 delegate_->ProcessExiting(process_type); | 785 delegate_->ProcessExiting(process_type); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 | 828 |
829 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 829 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
830 }; | 830 }; |
831 | 831 |
832 // static | 832 // static |
833 ContentMainRunner* ContentMainRunner::Create() { | 833 ContentMainRunner* ContentMainRunner::Create() { |
834 return new ContentMainRunnerImpl(); | 834 return new ContentMainRunnerImpl(); |
835 } | 835 } |
836 | 836 |
837 } // namespace content | 837 } // namespace content |
OLD | NEW |