Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: content/browser/zygote_host/zygote_host_impl_linux.cc

Issue 12213066: Use base namespace for FilePath in content/browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/worker_host/worker_process_host.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/browser/zygote_host/zygote_host_impl_linux.h" 5 #include "content/browser/zygote_host/zygote_host_impl_linux.h"
6 6
7 #include <sys/socket.h> 7 #include <sys/socket.h>
8 #include <sys/stat.h> 8 #include <sys/stat.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 // static 62 // static
63 ZygoteHostImpl* ZygoteHostImpl::GetInstance() { 63 ZygoteHostImpl* ZygoteHostImpl::GetInstance() {
64 return Singleton<ZygoteHostImpl>::get(); 64 return Singleton<ZygoteHostImpl>::get();
65 } 65 }
66 66
67 void ZygoteHostImpl::Init(const std::string& sandbox_cmd) { 67 void ZygoteHostImpl::Init(const std::string& sandbox_cmd) {
68 DCHECK(!init_); 68 DCHECK(!init_);
69 init_ = true; 69 init_ = true;
70 70
71 FilePath chrome_path; 71 base::FilePath chrome_path;
72 CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); 72 CHECK(PathService::Get(base::FILE_EXE, &chrome_path));
73 CommandLine cmd_line(chrome_path); 73 CommandLine cmd_line(chrome_path);
74 74
75 cmd_line.AppendSwitchASCII(switches::kProcessType, switches::kZygoteProcess); 75 cmd_line.AppendSwitchASCII(switches::kProcessType, switches::kZygoteProcess);
76 76
77 int fds[2]; 77 int fds[2];
78 #if defined(OS_FREEBSD) || defined(OS_OPENBSD) 78 #if defined(OS_FREEBSD) || defined(OS_OPENBSD)
79 // The BSDs often don't support SOCK_SEQPACKET yet, so fall back to 79 // The BSDs often don't support SOCK_SEQPACKET yet, so fall back to
80 // SOCK_DGRAM if necessary. 80 // SOCK_DGRAM if necessary.
81 if (socketpair(PF_UNIX, SOCK_SEQPACKET, 0, fds) != 0) 81 if (socketpair(PF_UNIX, SOCK_SEQPACKET, 0, fds) != 0)
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 // don't want to add another library to the build as it's sure to cause 365 // don't want to add another library to the build as it's sure to cause
366 // problems with other, non-SELinux distros. 366 // problems with other, non-SELinux distros.
367 // 367 //
368 // So we just check for files in /selinux. This isn't foolproof, but it's not 368 // So we just check for files in /selinux. This isn't foolproof, but it's not
369 // bad and it's easy. 369 // bad and it's easy.
370 370
371 static bool selinux; 371 static bool selinux;
372 static bool selinux_valid = false; 372 static bool selinux_valid = false;
373 373
374 if (!selinux_valid) { 374 if (!selinux_valid) {
375 const FilePath kSelinuxPath("/selinux"); 375 const base::FilePath kSelinuxPath("/selinux");
376 selinux = access(kSelinuxPath.value().c_str(), X_OK) == 0 && 376 selinux = access(kSelinuxPath.value().c_str(), X_OK) == 0 &&
377 file_util::CountFilesCreatedAfter(kSelinuxPath, 377 file_util::CountFilesCreatedAfter(kSelinuxPath,
378 base::Time::UnixEpoch()) > 0; 378 base::Time::UnixEpoch()) > 0;
379 selinux_valid = true; 379 selinux_valid = true;
380 } 380 }
381 381
382 if (using_suid_sandbox_ && !selinux) { 382 if (using_suid_sandbox_ && !selinux) {
383 #if defined(USE_TCMALLOC) 383 #if defined(USE_TCMALLOC)
384 // If heap profiling is running, these processes are not exiting, at least 384 // If heap profiling is running, these processes are not exiting, at least
385 // on ChromeOS. The easiest thing to do is not launch them when profiling. 385 // on ChromeOS. The easiest thing to do is not launch them when profiling.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 return RenderSandboxHostLinux::GetInstance()->pid(); 505 return RenderSandboxHostLinux::GetInstance()->pid();
506 } 506 }
507 507
508 int ZygoteHostImpl::GetSandboxStatus() const { 508 int ZygoteHostImpl::GetSandboxStatus() const {
509 if (have_read_sandbox_status_word_) 509 if (have_read_sandbox_status_word_)
510 return sandbox_status_; 510 return sandbox_status_;
511 return 0; 511 return 0;
512 } 512 }
513 513
514 } // namespace content 514 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/worker_host/worker_process_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698