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

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: Created 5 years, 7 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
Index: base/memory/shared_memory_posix.cc
diff --git a/base/memory/shared_memory_posix.cc b/base/memory/shared_memory_posix.cc
index 722a0b36767854411740cf14ca8d7d0c1ae36841..0ca75ba274cbd06ffa56d0442068304bb4c35b04 100644
--- a/base/memory/shared_memory_posix.cc
+++ b/base/memory/shared_memory_posix.cc
@@ -4,26 +4,19 @@
#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/process/process_metrics.h"
#include "base/profiler/scoped_tracker.h"
-#include "base/safe_strerror_posix.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 +31,6 @@ namespace base {
namespace {
-LazyInstance<Lock>::Leaky g_thread_lock_ = LAZY_INSTANCE_INITIALIZER;
-
struct ScopedPathUnlinkerTraits {
static FilePath* InvalidValue() { return nullptr; }
@@ -432,16 +423,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_);
@@ -510,25 +491,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:" << safe_strerror(errno);
- }
- }
-}
-
bool SharedMemory::ShareToProcessCommon(ProcessHandle process,
SharedMemoryHandle* new_handle,
bool close_self,

Powered by Google App Engine
This is Rietveld 408576698