| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <dlfcn.h> | 5 #include <dlfcn.h> |
| 6 #include <fcntl.h> | 6 #include <fcntl.h> |
| 7 #include <pthread.h> | 7 #include <pthread.h> |
| 8 #include <sys/epoll.h> | 8 #include <sys/epoll.h> |
| 9 #include <sys/prctl.h> | 9 #include <sys/prctl.h> |
| 10 #include <sys/signal.h> | 10 #include <sys/signal.h> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "base/linux_util.h" | 30 #include "base/linux_util.h" |
| 31 #include "base/nss_util.h" | 31 #include "base/nss_util.h" |
| 32 #include "base/path_service.h" | 32 #include "base/path_service.h" |
| 33 #include "base/pickle.h" | 33 #include "base/pickle.h" |
| 34 #include "base/process_util.h" | 34 #include "base/process_util.h" |
| 35 #include "base/rand_util.h" | 35 #include "base/rand_util.h" |
| 36 #include "base/scoped_ptr.h" | 36 #include "base/scoped_ptr.h" |
| 37 #include "base/sys_info.h" | 37 #include "base/sys_info.h" |
| 38 #include "build/build_config.h" | 38 #include "build/build_config.h" |
| 39 #include "chrome/common/chrome_descriptors.h" | 39 #include "chrome/common/chrome_descriptors.h" |
| 40 #include "chrome/common/chrome_paths.h" |
| 40 #include "chrome/common/chrome_switches.h" | 41 #include "chrome/common/chrome_switches.h" |
| 41 #include "chrome/common/pepper_plugin_registry.h" | 42 #include "chrome/common/pepper_plugin_registry.h" |
| 42 #include "content/common/font_config_ipc_linux.h" | 43 #include "content/common/font_config_ipc_linux.h" |
| 43 #include "content/common/main_function_params.h" | 44 #include "content/common/main_function_params.h" |
| 44 #include "content/common/process_watcher.h" | 45 #include "content/common/process_watcher.h" |
| 45 #include "content/common/result_codes.h" | 46 #include "content/common/result_codes.h" |
| 46 #include "content/common/sandbox_methods_linux.h" | 47 #include "content/common/sandbox_methods_linux.h" |
| 47 #include "content/common/set_process_title.h" | 48 #include "content/common/set_process_title.h" |
| 48 #include "content/common/unix_domain_socket_posix.h" | 49 #include "content/common/unix_domain_socket_posix.h" |
| 49 #include "media/base/media.h" | 50 #include "media/base/media.h" |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 base::RandUint64(); | 591 base::RandUint64(); |
| 591 | 592 |
| 592 base::SysInfo::MaxSharedMemorySize(); | 593 base::SysInfo::MaxSharedMemorySize(); |
| 593 | 594 |
| 594 // ICU DateFormat class (used in base/time_format.cc) needs to get the | 595 // ICU DateFormat class (used in base/time_format.cc) needs to get the |
| 595 // Olson timezone ID by accessing the zoneinfo files on disk. After | 596 // Olson timezone ID by accessing the zoneinfo files on disk. After |
| 596 // TimeZone::createDefault is called once here, the timezone ID is | 597 // TimeZone::createDefault is called once here, the timezone ID is |
| 597 // cached and there's no more need to access the file system. | 598 // cached and there's no more need to access the file system. |
| 598 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); | 599 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); |
| 599 | 600 |
| 600 FilePath module_path; | 601 // Each Renderer we spawn will re-attempt initialization of the media |
| 601 if (PathService::Get(base::DIR_MODULE, &module_path)) | 602 // libraries, at which point failure will be detected and handled, so |
| 602 media::InitializeMediaLibrary(module_path); | 603 // we do not need to cope with initialization failures here. |
| 604 FilePath media_path; |
| 605 if (PathService::Get(chrome::DIR_MEDIA_LIBS, &media_path)) |
| 606 media::InitializeMediaLibrary(media_path); |
| 603 | 607 |
| 604 // Remoting requires NSS to function properly. It is not used for other | 608 // Remoting requires NSS to function properly. It is not used for other |
| 605 // reasons so load NSS only if remoting is enabled. | 609 // reasons so load NSS only if remoting is enabled. |
| 606 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 610 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 607 if (command_line.HasSwitch(switches::kEnableRemoting)) { | 611 if (command_line.HasSwitch(switches::kEnableRemoting)) { |
| 608 // We are going to fork to engage the sandbox and we have not loaded | 612 // We are going to fork to engage the sandbox and we have not loaded |
| 609 // any security modules so it is safe to disable the fork check in NSS. | 613 // any security modules so it is safe to disable the fork check in NSS. |
| 610 base::DisableNSSForkCheck(); | 614 base::DisableNSSForkCheck(); |
| 611 | 615 |
| 612 // Initialize NSS so that we load the necessary library files | 616 // Initialize NSS so that we load the necessary library files |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 VLOG(1) << "Enabling experimental Seccomp sandbox."; | 766 VLOG(1) << "Enabling experimental Seccomp sandbox."; |
| 763 sandbox_flags |= ZygoteHost::kSandboxSeccomp; | 767 sandbox_flags |= ZygoteHost::kSandboxSeccomp; |
| 764 } | 768 } |
| 765 } | 769 } |
| 766 #endif // SECCOMP_SANDBOX | 770 #endif // SECCOMP_SANDBOX |
| 767 | 771 |
| 768 Zygote zygote(sandbox_flags); | 772 Zygote zygote(sandbox_flags); |
| 769 // This function call can return multiple times, once per fork(). | 773 // This function call can return multiple times, once per fork(). |
| 770 return zygote.ProcessRequests(); | 774 return zygote.ProcessRequests(); |
| 771 } | 775 } |
| OLD | NEW |