summaryrefslogtreecommitdiffstats
path: root/content/browser
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-17 19:02:35 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-17 19:02:35 +0000
commit42f558fdef03f1ec2261f554151d8a4d168919e4 (patch)
treea2f2403061c945c8983524036bc73550098de6b7 /content/browser
parentcb8d22b096bf5698bcf58725d6e4d7534e235a0a (diff)
downloadchromium_src-42f558fdef03f1ec2261f554151d8a4d168919e4.zip
chromium_src-42f558fdef03f1ec2261f554151d8a4d168919e4.tar.gz
chromium_src-42f558fdef03f1ec2261f554151d8a4d168919e4.tar.bz2
Implement ScopedFD in terms of ScopedGeneric.
Move to a new file base/files/scoped_file.h. I will also add ScopedFILE to here (currently in file_util.h) later. I think there is a crash in the old code in content/browser/zygote_host/zygote_host_impl_linux.cc that this patch should fix. The old ScopedFD took the address of something in a vector that is being modified. I removed SafeScopedFD from content/common/sandbox_linux/sandbox_linux.cc since base's ScopedFD not CHECKs on close failure (this is a more recent addition). Reland of https://codereview.chromium.org/191673003/ R=agl, viettrungluu Review URL: https://codereview.chromium.org/202113004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257473 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser')
-rw-r--r--content/browser/child_process_launcher.cc5
-rw-r--r--content/browser/zygote_host/zygote_host_impl_linux.cc6
2 files changed, 6 insertions, 5 deletions
diff --git a/content/browser/child_process_launcher.cc b/content/browser/child_process_launcher.cc
index cacf138..5d7b612 100644
--- a/content/browser/child_process_launcher.cc
+++ b/content/browser/child_process_launcher.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/file_util.h"
+#include "base/files/scoped_file.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/metrics/histogram.h"
@@ -228,7 +229,7 @@ class ChildProcessLauncher::Context
base::ProcessHandle handle = base::kNullProcessHandle;
// We need to close the client end of the IPC channel to reliably detect
// child termination.
- file_util::ScopedFD ipcfd_closer(&ipcfd);
+ base::ScopedFD ipcfd_closer(ipcfd);
#if !defined(OS_MACOSX)
GetContentClient()->browser()->
@@ -319,7 +320,7 @@ class ChildProcessLauncher::Context
base::ProcessHandle handle) {
#if defined(OS_ANDROID)
// Finally close the ipcfd
- file_util::ScopedFD ipcfd_closer(&ipcfd_);
+ base::ScopedFD ipcfd_closer(ipcfd_);
#endif
starting_ = false;
process_.set_handle(handle);
diff --git a/content/browser/zygote_host/zygote_host_impl_linux.cc b/content/browser/zygote_host/zygote_host_impl_linux.cc
index 18e9b69..aaf4d3b 100644
--- a/content/browser/zygote_host/zygote_host_impl_linux.cc
+++ b/content/browser/zygote_host/zygote_host_impl_linux.cc
@@ -14,6 +14,7 @@
#include "base/environment.h"
#include "base/file_util.h"
#include "base/files/file_enumerator.h"
+#include "base/files/scoped_file.h"
#include "base/linux_util.h"
#include "base/logging.h"
#include "base/memory/linked_ptr.h"
@@ -318,7 +319,7 @@ pid_t ZygoteHostImpl::ForkRequest(
std::vector<int> fds;
// Scoped pointers cannot be stored in containers, so we have to use a
// linked_ptr.
- std::vector<linked_ptr<file_util::ScopedFD> > autodelete_fds;
+ std::vector<linked_ptr<base::ScopedFD> > autodelete_fds;
for (std::vector<FileDescriptorInfo>::const_iterator
i = mapping.begin(); i != mapping.end(); ++i) {
pickle.WriteUInt32(i->id);
@@ -326,8 +327,7 @@ pid_t ZygoteHostImpl::ForkRequest(
if (i->fd.auto_close) {
// Auto-close means we need to close the FDs after they have been passed
// to the other process.
- linked_ptr<file_util::ScopedFD> ptr(
- new file_util::ScopedFD(&(fds.back())));
+ linked_ptr<base::ScopedFD> ptr(new base::ScopedFD(fds.back()));
autodelete_fds.push_back(ptr);
}
}