diff options
author | piman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-23 21:37:41 +0000 |
---|---|---|
committer | piman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-23 21:37:41 +0000 |
commit | be60b9a5c94c8439c236a820505ebad04460efc0 (patch) | |
tree | fcfb2b788bba22e24d050f799e5d6edf8f61f241 /base | |
parent | 2380f378654e66f58262e3eaa1f9ba0cd1da09e0 (diff) | |
download | chromium_src-be60b9a5c94c8439c236a820505ebad04460efc0.zip chromium_src-be60b9a5c94c8439c236a820505ebad04460efc0.tar.gz chromium_src-be60b9a5c94c8439c236a820505ebad04460efc0.tar.bz2 |
Dup command-buffer SHM handle before auto-closing.
This also adds error logging to the various places we close file descriptors, to help diagnosing future similar issues.
BUG=none
TEST=Pepper Flash + youtube in oop with --enable-accelerated-plugins
Review URL: http://codereview.chromium.org/6549037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75792 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/shared_memory_posix.cc | 6 | ||||
-rw-r--r-- | base/sync_socket_posix.cc | 16 |
2 files changed, 15 insertions, 7 deletions
diff --git a/base/shared_memory_posix.cc b/base/shared_memory_posix.cc index 843322b..cafda5a 100644 --- a/base/shared_memory_posix.cc +++ b/base/shared_memory_posix.cc @@ -79,7 +79,8 @@ SharedMemoryHandle SharedMemory::NULLHandle() { // static void SharedMemory::CloseHandle(const SharedMemoryHandle& handle) { DCHECK(handle.fd >= 0); - close(handle.fd); + if (HANDLE_EINTR(close(handle.fd)) < 0) + PLOG(ERROR) << "close"; } bool SharedMemory::CreateAndMapAnonymous(uint32 size) { @@ -229,7 +230,8 @@ void SharedMemory::Close() { Unmap(); if (mapped_file_ > 0) { - close(mapped_file_); + if (HANDLE_EINTR(close(mapped_file_)) < 0) + PLOG(ERROR) << "close"; mapped_file_ = -1; } } diff --git a/base/sync_socket_posix.cc b/base/sync_socket_posix.cc index c2020c2..91467b1 100644 --- a/base/sync_socket_posix.cc +++ b/base/sync_socket_posix.cc @@ -63,10 +63,14 @@ bool SyncSocket::CreatePair(SyncSocket* pair[2]) { return true; cleanup: - if (handles[0] != kInvalidHandle) - (void) close(handles[0]); - if (handles[1] != kInvalidHandle) - (void) close(handles[1]); + if (handles[0] != kInvalidHandle) { + if (HANDLE_EINTR(close(handles[0])) < 0) + PLOG(ERROR) << "close"; + } + if (handles[1] != kInvalidHandle) { + if (HANDLE_EINTR(close(handles[1])) < 0) + PLOG(ERROR) << "close"; + } delete tmp_sockets[0]; delete tmp_sockets[1]; return false; @@ -76,7 +80,9 @@ bool SyncSocket::Close() { if (handle_ == kInvalidHandle) { return false; } - int retval = close(handle_); + int retval = HANDLE_EINTR(close(handle_)); + if (retval < 0) + PLOG(ERROR) << "close"; handle_ = kInvalidHandle; return (retval == 0); } |