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 18 matching lines...) Expand all Loading... | |
29 #include "base/hash_tables.h" | 29 #include "base/hash_tables.h" |
30 #include "base/linux_util.h" | 30 #include "base/linux_util.h" |
31 #include "base/path_service.h" | 31 #include "base/path_service.h" |
32 #include "base/pickle.h" | 32 #include "base/pickle.h" |
33 #include "base/process_util.h" | 33 #include "base/process_util.h" |
34 #include "base/rand_util.h" | 34 #include "base/rand_util.h" |
35 #include "base/scoped_ptr.h" | 35 #include "base/scoped_ptr.h" |
36 #include "base/sys_info.h" | 36 #include "base/sys_info.h" |
37 #include "build/build_config.h" | 37 #include "build/build_config.h" |
38 #include "chrome/common/chrome_descriptors.h" | 38 #include "chrome/common/chrome_descriptors.h" |
39 #include "chrome/common/chrome_paths.h" | |
39 #include "chrome/common/chrome_switches.h" | 40 #include "chrome/common/chrome_switches.h" |
40 #include "chrome/common/font_config_ipc_linux.h" | 41 #include "chrome/common/font_config_ipc_linux.h" |
41 #include "chrome/common/main_function_params.h" | 42 #include "chrome/common/main_function_params.h" |
42 #include "chrome/common/pepper_plugin_registry.h" | 43 #include "chrome/common/pepper_plugin_registry.h" |
43 #include "chrome/common/process_watcher.h" | 44 #include "chrome/common/process_watcher.h" |
44 #include "chrome/common/result_codes.h" | 45 #include "chrome/common/result_codes.h" |
45 #include "chrome/common/sandbox_methods_linux.h" | 46 #include "chrome/common/sandbox_methods_linux.h" |
46 #include "chrome/common/set_process_title.h" | 47 #include "chrome/common/set_process_title.h" |
47 #include "chrome/common/unix_domain_socket_posix.h" | 48 #include "chrome/common/unix_domain_socket_posix.h" |
48 #include "media/base/media.h" | 49 #include "media/base/media.h" |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
589 base::RandUint64(); | 590 base::RandUint64(); |
590 | 591 |
591 base::SysInfo::MaxSharedMemorySize(); | 592 base::SysInfo::MaxSharedMemorySize(); |
592 | 593 |
593 // ICU DateFormat class (used in base/time_format.cc) needs to get the | 594 // ICU DateFormat class (used in base/time_format.cc) needs to get the |
594 // Olson timezone ID by accessing the zoneinfo files on disk. After | 595 // Olson timezone ID by accessing the zoneinfo files on disk. After |
595 // TimeZone::createDefault is called once here, the timezone ID is | 596 // TimeZone::createDefault is called once here, the timezone ID is |
596 // cached and there's no more need to access the file system. | 597 // cached and there's no more need to access the file system. |
597 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); | 598 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); |
598 | 599 |
599 FilePath module_path; | 600 // If we can't get a path to load media libraries from, or if loading |
600 if (PathService::Get(base::DIR_MODULE, &module_path)) | 601 // them fails, we'll crash if we try to call into them. Code should |
601 media::InitializeMediaLibrary(module_path); | 602 // be sure to check media::IsMediaLibraryInitialized() before doing so! |
awong
2011/02/25 02:41:59
Exclamations are discouraged in comments :)
| |
603 FilePath media_path; | |
604 if (PathService::Get(chrome::DIR_MEDIA_LIBS, &media_path)) | |
605 media::InitializeMediaLibrary(media_path); | |
602 | 606 |
603 // Ensure access to the Pepper plugins before the sandbox is turned on. | 607 // Ensure access to the Pepper plugins before the sandbox is turned on. |
604 PepperPluginRegistry::PreloadModules(); | 608 PepperPluginRegistry::PreloadModules(); |
605 } | 609 } |
606 | 610 |
607 #if !defined(CHROMIUM_SELINUX) | 611 #if !defined(CHROMIUM_SELINUX) |
608 static bool EnterSandbox() { | 612 static bool EnterSandbox() { |
609 // The SUID sandbox sets this environment variable to a file descriptor | 613 // The SUID sandbox sets this environment variable to a file descriptor |
610 // over which we can signal that we have completed our startup and can be | 614 // over which we can signal that we have completed our startup and can be |
611 // chrooted. | 615 // chrooted. |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
744 VLOG(1) << "Enabling experimental Seccomp sandbox."; | 748 VLOG(1) << "Enabling experimental Seccomp sandbox."; |
745 sandbox_flags |= ZygoteHost::kSandboxSeccomp; | 749 sandbox_flags |= ZygoteHost::kSandboxSeccomp; |
746 } | 750 } |
747 } | 751 } |
748 #endif // SECCOMP_SANDBOX | 752 #endif // SECCOMP_SANDBOX |
749 | 753 |
750 Zygote zygote(sandbox_flags); | 754 Zygote zygote(sandbox_flags); |
751 // This function call can return multiple times, once per fork(). | 755 // This function call can return multiple times, once per fork(). |
752 return zygote.ProcessRequests(); | 756 return zygote.ProcessRequests(); |
753 } | 757 } |
OLD | NEW |