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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 const base::CommandLine& command_line = | 615 const base::CommandLine& command_line = |
616 *base::CommandLine::ForCurrentProcess(); | 616 *base::CommandLine::ForCurrentProcess(); |
617 std::string process_type = | 617 std::string process_type = |
618 command_line.GetSwitchValueASCII(switches::kProcessType); | 618 command_line.GetSwitchValueASCII(switches::kProcessType); |
619 | 619 |
620 #if !defined(OS_IOS) | 620 #if !defined(OS_IOS) |
621 // Initialize mojo here so that services can be registered. | 621 // Initialize mojo here so that services can be registered. |
622 InitializeMojo(); | 622 InitializeMojo(); |
623 #endif | 623 #endif |
624 | 624 |
| 625 #if defined(OS_WIN) |
| 626 bool init_device_scale_factor = true; |
| 627 if (command_line.HasSwitch(switches::kDeviceScaleFactor)) { |
| 628 std::string scale_factor_string = command_line.GetSwitchValueASCII( |
| 629 switches::kDeviceScaleFactor); |
| 630 double scale_factor = 0; |
| 631 if (base::StringToDouble(scale_factor_string, &scale_factor)) { |
| 632 init_device_scale_factor = false; |
| 633 gfx::InitDeviceScaleFactor(scale_factor); |
| 634 } |
| 635 } |
| 636 if (init_device_scale_factor) |
| 637 ui::win::InitDeviceScaleFactor(); |
| 638 #endif |
| 639 |
625 if (!GetContentClient()) | 640 if (!GetContentClient()) |
626 SetContentClient(&empty_content_client_); | 641 SetContentClient(&empty_content_client_); |
627 ContentClientInitializer::Set(process_type, delegate_); | 642 ContentClientInitializer::Set(process_type, delegate_); |
628 | 643 |
629 #if defined(OS_WIN) | 644 #if defined(OS_WIN) |
630 // Route stdio to parent console (if any) or create one. | 645 // Route stdio to parent console (if any) or create one. |
631 if (command_line.HasSwitch(switches::kEnableLogging)) | 646 if (command_line.HasSwitch(switches::kEnableLogging)) |
632 base::RouteStdioToConsole(); | 647 base::RouteStdioToConsole(); |
633 #endif | 648 #endif |
634 | 649 |
(...skipping 24 matching lines...) Expand all Loading... |
659 (delegate_ && | 674 (delegate_ && |
660 delegate_->ProcessRegistersWithSystemProcess(process_type))) { | 675 delegate_->ProcessRegistersWithSystemProcess(process_type))) { |
661 base::PowerMonitorDeviceSource::AllocateSystemIOPorts(); | 676 base::PowerMonitorDeviceSource::AllocateSystemIOPorts(); |
662 } | 677 } |
663 | 678 |
664 if (!process_type.empty() && | 679 if (!process_type.empty() && |
665 (!delegate_ || delegate_->ShouldSendMachPort(process_type))) { | 680 (!delegate_ || delegate_->ShouldSendMachPort(process_type))) { |
666 MachBroker::ChildSendTaskPortToParent(); | 681 MachBroker::ChildSendTaskPortToParent(); |
667 } | 682 } |
668 #elif defined(OS_WIN) | 683 #elif defined(OS_WIN) |
669 bool init_device_scale_factor = true; | |
670 if (command_line.HasSwitch(switches::kDeviceScaleFactor)) { | |
671 std::string scale_factor_string = command_line.GetSwitchValueASCII( | |
672 switches::kDeviceScaleFactor); | |
673 double scale_factor = 0; | |
674 if (base::StringToDouble(scale_factor_string, &scale_factor)) { | |
675 init_device_scale_factor = false; | |
676 gfx::InitDeviceScaleFactor(scale_factor); | |
677 } | |
678 } | |
679 if (init_device_scale_factor) | |
680 ui::win::InitDeviceScaleFactor(); | |
681 | |
682 SetupCRT(command_line); | 684 SetupCRT(command_line); |
683 #endif | 685 #endif |
684 | 686 |
685 #if defined(OS_POSIX) | 687 #if defined(OS_POSIX) |
686 if (!process_type.empty()) { | 688 if (!process_type.empty()) { |
687 // When you hit Ctrl-C in a terminal running the browser | 689 // When you hit Ctrl-C in a terminal running the browser |
688 // process, a SIGINT is delivered to the entire process group. | 690 // process, a SIGINT is delivered to the entire process group. |
689 // When debugging the browser process via gdb, gdb catches the | 691 // When debugging the browser process via gdb, gdb catches the |
690 // SIGINT for the browser process (and dumps you back to the gdb | 692 // SIGINT for the browser process (and dumps you back to the gdb |
691 // console) but doesn't for the child processes, killing them. | 693 // console) but doesn't for the child processes, killing them. |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 | 828 |
827 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 829 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
828 }; | 830 }; |
829 | 831 |
830 // static | 832 // static |
831 ContentMainRunner* ContentMainRunner::Create() { | 833 ContentMainRunner* ContentMainRunner::Create() { |
832 return new ContentMainRunnerImpl(); | 834 return new ContentMainRunnerImpl(); |
833 } | 835 } |
834 | 836 |
835 } // namespace content | 837 } // namespace content |
OLD | NEW |