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

Unified Diff: base/memory/shared_memory_posix.cc

Issue 1167863002: Remove unused locking functionality from base::SharedMemory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shared_memory_remove_abtest
Patch Set: Remove constant from android translation unit. Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/memory/shared_memory_nacl.cc ('k') | base/memory/shared_memory_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/shared_memory_posix.cc
diff --git a/base/memory/shared_memory_posix.cc b/base/memory/shared_memory_posix.cc
index 35d746e5394e0e042bbaac33421d94c8406e65e2..8aaa9ce443890f64140c06cb9e0a4b410bdf711d 100644
--- a/base/memory/shared_memory_posix.cc
+++ b/base/memory/shared_memory_posix.cc
@@ -4,16 +4,13 @@
#include "base/memory/shared_memory.h"
-#include <errno.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <unistd.h>
#include "base/files/file_util.h"
#include "base/files/scoped_file.h"
-#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/posix/eintr_wrapper.h"
#include "base/posix/safe_strerror.h"
@@ -21,9 +18,6 @@
#include "base/profiler/scoped_tracker.h"
#include "base/scoped_generic.h"
#include "base/strings/utf_string_conversions.h"
-#include "base/synchronization/lock.h"
-#include "base/threading/platform_thread.h"
-#include "base/threading/thread_restrictions.h"
#if defined(OS_MACOSX)
#include "base/mac/foundation_util.h"
@@ -38,8 +32,6 @@ namespace base {
namespace {
-LazyInstance<Lock>::Leaky g_thread_lock_ = LAZY_INSTANCE_INITIALIZER;
-
struct ScopedPathUnlinkerTraits {
static FilePath* InvalidValue() { return nullptr; }
@@ -414,16 +406,6 @@ void SharedMemory::Close() {
}
}
-void SharedMemory::LockDeprecated() {
- g_thread_lock_.Get().Acquire();
- LockOrUnlockCommon(F_LOCK);
-}
-
-void SharedMemory::UnlockDeprecated() {
- LockOrUnlockCommon(F_ULOCK);
- g_thread_lock_.Get().Release();
-}
-
#if !defined(OS_ANDROID)
bool SharedMemory::PrepareMapFile(ScopedFILE fp, ScopedFD readonly_fd) {
DCHECK_EQ(-1, mapped_file_);
@@ -491,25 +473,6 @@ bool SharedMemory::FilePathForMemoryName(const std::string& mem_name,
}
#endif // !defined(OS_ANDROID)
-void SharedMemory::LockOrUnlockCommon(int function) {
- DCHECK_GE(mapped_file_, 0);
- while (lockf(mapped_file_, function, 0) < 0) {
- if (errno == EINTR) {
- continue;
- } else if (errno == ENOLCK) {
- // temporary kernel resource exaustion
- base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(500));
- continue;
- } else {
- NOTREACHED() << "lockf() failed."
- << " function:" << function
- << " fd:" << mapped_file_
- << " errno:" << errno
- << " msg:" << base::safe_strerror(errno);
- }
- }
-}
-
bool SharedMemory::ShareToProcessCommon(ProcessHandle process,
SharedMemoryHandle* new_handle,
bool close_self,
« no previous file with comments | « base/memory/shared_memory_nacl.cc ('k') | base/memory/shared_memory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698