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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 } | 479 } |
480 | 480 |
481 static void ReleaseFreeMemoryThunk() { | 481 static void ReleaseFreeMemoryThunk() { |
482 MallocExtension::instance()->ReleaseFreeMemory(); | 482 MallocExtension::instance()->ReleaseFreeMemory(); |
483 } | 483 } |
484 #endif | 484 #endif |
485 | 485 |
486 int Initialize(const ContentMainParams& params) override { | 486 int Initialize(const ContentMainParams& params) override { |
487 ui_task_ = params.ui_task; | 487 ui_task_ = params.ui_task; |
488 | 488 |
| 489 base::EnableTerminationOnOutOfMemory(); |
489 #if defined(OS_WIN) | 490 #if defined(OS_WIN) |
490 RegisterInvalidParamHandler(); | 491 RegisterInvalidParamHandler(); |
491 ui::win::CreateATLModuleIfNeeded(); | 492 ui::win::CreateATLModuleIfNeeded(); |
492 | 493 |
493 sandbox_info_ = *params.sandbox_info; | 494 sandbox_info_ = *params.sandbox_info; |
494 #else // !OS_WIN | 495 #else // !OS_WIN |
495 | 496 |
496 #if defined(OS_ANDROID) | 497 #if defined(OS_ANDROID) |
497 // See note at the initialization of ExitManager, below; basically, | 498 // See note at the initialization of ExitManager, below; basically, |
498 // only Android builds have the ctor/dtor handlers set up to use | 499 // only Android builds have the ctor/dtor handlers set up to use |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 | 596 |
596 #if !defined(OS_WIN) | 597 #if !defined(OS_WIN) |
597 argc = params.argc; | 598 argc = params.argc; |
598 argv = params.argv; | 599 argv = params.argv; |
599 #endif | 600 #endif |
600 | 601 |
601 base::CommandLine::Init(argc, argv); | 602 base::CommandLine::Init(argc, argv); |
602 | 603 |
603 if (!delegate_ || delegate_->ShouldEnableTerminationOnHeapCorruption()) | 604 if (!delegate_ || delegate_->ShouldEnableTerminationOnHeapCorruption()) |
604 base::EnableTerminationOnHeapCorruption(); | 605 base::EnableTerminationOnHeapCorruption(); |
605 base::EnableTerminationOnOutOfMemory(); | |
606 | 606 |
607 #if !defined(OS_IOS) | 607 #if !defined(OS_IOS) |
608 SetProcessTitleFromCommandLine(argv); | 608 SetProcessTitleFromCommandLine(argv); |
609 #endif | 609 #endif |
610 #endif // !OS_ANDROID | 610 #endif // !OS_ANDROID |
611 | 611 |
612 int exit_code = 0; | 612 int exit_code = 0; |
613 if (delegate_ && delegate_->BasicStartupComplete(&exit_code)) | 613 if (delegate_ && delegate_->BasicStartupComplete(&exit_code)) |
614 return exit_code; | 614 return exit_code; |
615 | 615 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 | 859 |
860 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 860 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
861 }; | 861 }; |
862 | 862 |
863 // static | 863 // static |
864 ContentMainRunner* ContentMainRunner::Create() { | 864 ContentMainRunner* ContentMainRunner::Create() { |
865 return new ContentMainRunnerImpl(); | 865 return new ContentMainRunnerImpl(); |
866 } | 866 } |
867 | 867 |
868 } // namespace content | 868 } // namespace content |
OLD | NEW |