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

Unified Diff: base/memory/discardable_shared_memory.cc

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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/discardable_memory_win.cc ('k') | base/memory/discardable_shared_memory_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/discardable_shared_memory.cc
diff --git a/base/memory/discardable_shared_memory.cc b/base/memory/discardable_shared_memory.cc
index 3805bedccf1b6bcad2595ba6344241458679fb5f..49e93cdaf6f22a20e0a76fd0128b5aa8cdd743dd 100644
--- a/base/memory/discardable_shared_memory.cc
+++ b/base/memory/discardable_shared_memory.cc
@@ -162,19 +162,19 @@ DiscardableSharedMemory::LockResult DiscardableSharedMemory::Lock(
DCHECK_EQ(AlignToPageSize(offset), offset);
DCHECK_EQ(AlignToPageSize(length), length);
- // Calls to this function must synchronized properly.
+ // Calls to this function must be synchronized properly.
DFAKE_SCOPED_LOCK(thread_collision_warner_);
- // Return false when instance has been purged or not initialized properly by
- // checking if |last_known_usage_| is NULL.
- if (last_known_usage_.is_null())
- return FAILED;
-
DCHECK(shared_memory_.memory());
// We need to successfully acquire the platform independent lock before
// individual pages can be locked.
if (!locked_page_count_) {
+ // Return false when instance has been purged or not initialized properly
+ // by checking if |last_known_usage_| is NULL.
+ if (last_known_usage_.is_null())
+ return FAILED;
+
SharedState old_state(SharedState::UNLOCKED, last_known_usage_);
SharedState new_state(SharedState::LOCKED, Time());
SharedState result(subtle::Acquire_CompareAndSwap(
@@ -226,7 +226,7 @@ void DiscardableSharedMemory::Unlock(size_t offset, size_t length) {
DCHECK_EQ(AlignToPageSize(offset), offset);
DCHECK_EQ(AlignToPageSize(length), length);
- // Calls to this function must synchronized properly.
+ // Calls to this function must be synchronized properly.
DFAKE_SCOPED_LOCK(thread_collision_warner_);
// Zero for length means "everything onward".
@@ -294,7 +294,7 @@ void* DiscardableSharedMemory::memory() const {
}
bool DiscardableSharedMemory::Purge(Time current_time) {
- // Calls to this function must synchronized properly.
+ // Calls to this function must be synchronized properly.
DFAKE_SCOPED_LOCK(thread_collision_warner_);
// Early out if not mapped. This can happen if the segment was previously
« no previous file with comments | « base/memory/discardable_memory_win.cc ('k') | base/memory/discardable_shared_memory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698