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

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

Issue 16392011: Move FileEnumerator to its own file, do some refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix incorrect includes Created 7 years, 6 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/storage_partition_impl_map.cc ('k') | content/test/image_decoder_test.cc » ('j') | 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>
11 11
12 #include "base/base_switches.h" 12 #include "base/base_switches.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/environment.h" 14 #include "base/environment.h"
15 #include "base/file_util.h" 15 #include "base/file_util.h"
16 #include "base/files/file_enumerator.h"
16 #include "base/linux_util.h" 17 #include "base/linux_util.h"
17 #include "base/logging.h" 18 #include "base/logging.h"
18 #include "base/memory/linked_ptr.h" 19 #include "base/memory/linked_ptr.h"
19 #include "base/memory/scoped_ptr.h" 20 #include "base/memory/scoped_ptr.h"
20 #include "base/metrics/histogram.h" 21 #include "base/metrics/histogram.h"
21 #include "base/path_service.h" 22 #include "base/path_service.h"
22 #include "base/posix/eintr_wrapper.h" 23 #include "base/posix/eintr_wrapper.h"
23 #include "base/posix/unix_domain_socket_linux.h" 24 #include "base/posix/unix_domain_socket_linux.h"
24 #include "base/process_util.h" 25 #include "base/process_util.h"
25 #include "base/string_number_conversions.h" 26 #include "base/string_number_conversions.h"
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 // problems with other, non-SELinux distros. 365 // problems with other, non-SELinux distros.
365 // 366 //
366 // So we just check for files in /selinux. This isn't foolproof, but it's not 367 // So we just check for files in /selinux. This isn't foolproof, but it's not
367 // bad and it's easy. 368 // bad and it's easy.
368 369
369 static bool selinux; 370 static bool selinux;
370 static bool selinux_valid = false; 371 static bool selinux_valid = false;
371 372
372 if (!selinux_valid) { 373 if (!selinux_valid) {
373 const base::FilePath kSelinuxPath("/selinux"); 374 const base::FilePath kSelinuxPath("/selinux");
374 file_util::FileEnumerator en(kSelinuxPath, false, 375 base::FileEnumerator en(kSelinuxPath, false, base::FileEnumerator::FILES);
375 file_util::FileEnumerator::FILES);
376 bool has_selinux_files = !en.Next().empty(); 376 bool has_selinux_files = !en.Next().empty();
377 377
378 selinux = access(kSelinuxPath.value().c_str(), X_OK) == 0 && 378 selinux = access(kSelinuxPath.value().c_str(), X_OK) == 0 &&
379 has_selinux_files; 379 has_selinux_files;
380 selinux_valid = true; 380 selinux_valid = true;
381 } 381 }
382 382
383 if (using_suid_sandbox_ && !selinux) { 383 if (using_suid_sandbox_ && !selinux) {
384 #if defined(USE_TCMALLOC) 384 #if defined(USE_TCMALLOC)
385 // If heap profiling is running, these processes are not exiting, at least 385 // If heap profiling is running, these processes are not exiting, at least
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 return RenderSandboxHostLinux::GetInstance()->pid(); 506 return RenderSandboxHostLinux::GetInstance()->pid();
507 } 507 }
508 508
509 int ZygoteHostImpl::GetSandboxStatus() const { 509 int ZygoteHostImpl::GetSandboxStatus() const {
510 if (have_read_sandbox_status_word_) 510 if (have_read_sandbox_status_word_)
511 return sandbox_status_; 511 return sandbox_status_;
512 return 0; 512 return 0;
513 } 513 }
514 514
515 } // namespace content 515 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/storage_partition_impl_map.cc ('k') | content/test/image_decoder_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698