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

Unified Diff: base/memory/discardable_shared_memory.cc

Issue 2843113002: make base::SharedMemoryHandle a class on POSIX. (Closed)
Patch Set: Fix test error. Created 3 years, 8 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/discardable_shared_memory.cc
diff --git a/base/memory/discardable_shared_memory.cc b/base/memory/discardable_shared_memory.cc
index 99d2991308a3cd503543f5c6da2cbcc6ef1765e1..89d67af827e4adf82aa1d5089e79982dd369d8fc 100644
--- a/base/memory/discardable_shared_memory.cc
+++ b/base/memory/discardable_shared_memory.cc
@@ -224,9 +224,10 @@ DiscardableSharedMemory::LockResult DiscardableSharedMemory::Lock(
// Pin pages if supported.
#if defined(OS_ANDROID)
SharedMemoryHandle handle = shared_memory_.handle();
- if (SharedMemory::IsHandleValid(handle)) {
- if (ashmem_pin_region(
- handle.fd, AlignToPageSize(sizeof(SharedState)) + offset, length)) {
+ if (handle.IsValid()) {
+ if (ashmem_pin_region(handle.GetHandle(),
+ AlignToPageSize(sizeof(SharedState)) + offset,
+ length)) {
return PURGED;
}
}
@@ -251,9 +252,10 @@ void DiscardableSharedMemory::Unlock(size_t offset, size_t length) {
// Unpin pages if supported.
#if defined(OS_ANDROID)
SharedMemoryHandle handle = shared_memory_.handle();
- if (SharedMemory::IsHandleValid(handle)) {
- if (ashmem_unpin_region(
- handle.fd, AlignToPageSize(sizeof(SharedState)) + offset, length)) {
+ if (handle.IsValid()) {
+ if (ashmem_unpin_region(handle.GetHandle(),
+ AlignToPageSize(sizeof(SharedState)) + offset,
+ length)) {
DPLOG(ERROR) << "ashmem_unpin_region() failed";
}
}
« no previous file with comments | « base/BUILD.gn ('k') | base/memory/shared_memory.h » ('j') | base/memory/shared_memory_handle.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698