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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 #if !defined(OS_MACOSX) | 103 #if !defined(OS_MACOSX) |
104 #include "content/public/common/content_descriptors.h" | 104 #include "content/public/common/content_descriptors.h" |
105 #include "content/public/common/zygote_fork_delegate_linux.h" | 105 #include "content/public/common/zygote_fork_delegate_linux.h" |
106 #endif | 106 #endif |
107 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | 107 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
108 #include "content/zygote/zygote_main.h" | 108 #include "content/zygote/zygote_main.h" |
109 #endif | 109 #endif |
110 | 110 |
111 #endif // OS_POSIX | 111 #endif // OS_POSIX |
112 | 112 |
113 #if defined(USE_OZONE) | |
114 #include "ui/ozone/public/client_native_pixmap_manager.h" | |
115 #endif | |
116 | |
113 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC) | 117 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC) |
114 extern "C" { | 118 extern "C" { |
115 int tc_set_new_mode(int mode); | 119 int tc_set_new_mode(int mode); |
116 } | 120 } |
117 #endif | 121 #endif |
118 | 122 |
119 namespace content { | 123 namespace content { |
120 extern int GpuMain(const content::MainFunctionParams&); | 124 extern int GpuMain(const content::MainFunctionParams&); |
121 #if defined(ENABLE_PLUGINS) | 125 #if defined(ENABLE_PLUGINS) |
122 #if !defined(OS_LINUX) | 126 #if !defined(OS_LINUX) |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
645 delegate_->ProcessRegistersWithSystemProcess(process_type))) { | 649 delegate_->ProcessRegistersWithSystemProcess(process_type))) { |
646 base::PowerMonitorDeviceSource::AllocateSystemIOPorts(); | 650 base::PowerMonitorDeviceSource::AllocateSystemIOPorts(); |
647 } | 651 } |
648 | 652 |
649 if (!process_type.empty() && | 653 if (!process_type.empty() && |
650 (!delegate_ || delegate_->ShouldSendMachPort(process_type))) { | 654 (!delegate_ || delegate_->ShouldSendMachPort(process_type))) { |
651 MachBroker::ChildSendTaskPortToParent(); | 655 MachBroker::ChildSendTaskPortToParent(); |
652 } | 656 } |
653 | 657 |
654 if (!command_line.HasSwitch(switches::kSingleProcess) && | 658 if (!command_line.HasSwitch(switches::kSingleProcess) && |
655 !process_type.empty() && (process_type == switches::kRendererProcess || | 659 !process_type.empty() && (process_type == switches::kRendererProcess || |
dshwang
2015/08/03 12:51:48
spang, in the same sense, kZygoteProcess is needed
spang
2015/08/03 18:24:51
I'm not sure if the zygote is used on mac..
| |
656 process_type == switches::kGpuProcess)) { | 660 process_type == switches::kGpuProcess)) { |
657 base::mac::ScopedMachSendRight service_port = | 661 base::mac::ScopedMachSendRight service_port = |
658 BrowserIOSurfaceManager::LookupServicePort(getppid()); | 662 BrowserIOSurfaceManager::LookupServicePort(getppid()); |
659 if (service_port.is_valid()) { | 663 if (service_port.is_valid()) { |
660 ChildIOSurfaceManager::GetInstance()->set_service_port( | 664 ChildIOSurfaceManager::GetInstance()->set_service_port( |
661 service_port.release()); | 665 service_port.release()); |
662 IOSurfaceManager::SetInstance(ChildIOSurfaceManager::GetInstance()); | 666 IOSurfaceManager::SetInstance(ChildIOSurfaceManager::GetInstance()); |
663 } | 667 } |
664 } | 668 } |
665 #elif defined(OS_WIN) | 669 #elif defined(OS_WIN) |
666 SetupCRT(command_line); | 670 SetupCRT(command_line); |
667 #endif | 671 #endif |
668 | 672 |
673 #if defined(USE_OZONE) | |
674 if (process_type == switches::kRendererProcess) { | |
spang
2015/08/01 02:14:56
This doesn't work for me. You have to also do it f
dshwang
2015/08/03 12:51:48
Why do you think so? Zygote don't need to handle n
spang
2015/08/03 18:24:51
Zygote runs this initialization once, and then for
dshwang
2015/08/04 13:05:21
It run well in render process, no matter zygote en
| |
675 client_native_pixmap_manager_ = ui::ClientNativePixmapManager::Create(); | |
676 ui::ClientNativePixmapManager::SetInstance( | |
677 client_native_pixmap_manager_.get()); | |
678 } | |
679 #endif | |
680 | |
669 #if defined(OS_POSIX) | 681 #if defined(OS_POSIX) |
670 if (!process_type.empty()) { | 682 if (!process_type.empty()) { |
671 // When you hit Ctrl-C in a terminal running the browser | 683 // When you hit Ctrl-C in a terminal running the browser |
672 // process, a SIGINT is delivered to the entire process group. | 684 // process, a SIGINT is delivered to the entire process group. |
673 // When debugging the browser process via gdb, gdb catches the | 685 // When debugging the browser process via gdb, gdb catches the |
674 // SIGINT for the browser process (and dumps you back to the gdb | 686 // SIGINT for the browser process (and dumps you back to the gdb |
675 // console) but doesn't for the child processes, killing them. | 687 // console) but doesn't for the child processes, killing them. |
676 // The fix is to have child processes ignore SIGINT; they'll die | 688 // The fix is to have child processes ignore SIGINT; they'll die |
677 // on their own when the browser process goes away. | 689 // on their own when the browser process goes away. |
678 // | 690 // |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
839 | 851 |
840 // The delegate will outlive this object. | 852 // The delegate will outlive this object. |
841 ContentMainDelegate* delegate_; | 853 ContentMainDelegate* delegate_; |
842 | 854 |
843 scoped_ptr<base::AtExitManager> exit_manager_; | 855 scoped_ptr<base::AtExitManager> exit_manager_; |
844 #if defined(OS_WIN) | 856 #if defined(OS_WIN) |
845 sandbox::SandboxInterfaceInfo sandbox_info_; | 857 sandbox::SandboxInterfaceInfo sandbox_info_; |
846 #elif defined(OS_MACOSX) | 858 #elif defined(OS_MACOSX) |
847 scoped_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool_; | 859 scoped_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool_; |
848 #endif | 860 #endif |
861 #if defined(USE_OZONE) | |
862 scoped_ptr<ui::ClientNativePixmapManager> client_native_pixmap_manager_; | |
863 #endif | |
849 | 864 |
850 base::Closure* ui_task_; | 865 base::Closure* ui_task_; |
851 | 866 |
852 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 867 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
853 }; | 868 }; |
854 | 869 |
855 // static | 870 // static |
856 ContentMainRunner* ContentMainRunner::Create() { | 871 ContentMainRunner* ContentMainRunner::Create() { |
857 return new ContentMainRunnerImpl(); | 872 return new ContentMainRunnerImpl(); |
858 } | 873 } |
859 | 874 |
860 } // namespace content | 875 } // namespace content |
OLD | NEW |