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

Unified Diff: base/metrics/persistent_memory_allocator.cc

Issue 2886453002: Use acquire/relase for delayed persistent allocations. (Closed)
Patch Set: rebased Created 3 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
« no previous file with comments | « base/metrics/persistent_memory_allocator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/persistent_memory_allocator.cc
diff --git a/base/metrics/persistent_memory_allocator.cc b/base/metrics/persistent_memory_allocator.cc
index 3c5198ae9eaaf18ecab312107239e6f5c82c0bb6..deb82ac1dbe28aa26d14ee98f48139b3068b3488 100644
--- a/base/metrics/persistent_memory_allocator.cc
+++ b/base/metrics/persistent_memory_allocator.cc
@@ -1133,7 +1133,7 @@ DelayedPersistentAllocation::~DelayedPersistentAllocation() {}
void* DelayedPersistentAllocation::Get() const {
// Relaxed operations are acceptable here because it's not protecting the
// contents of the allocation in any way.
- Reference ref = reference_->load(std::memory_order_relaxed);
+ Reference ref = reference_->load(std::memory_order_acquire);
if (!ref) {
ref = allocator_->Allocate(size_, type_);
if (!ref)
@@ -1144,7 +1144,7 @@ void* DelayedPersistentAllocation::Get() const {
// cannot be retried.
Reference existing = 0; // Must be mutable; receives actual value.
if (reference_->compare_exchange_strong(existing, ref,
- std::memory_order_relaxed,
+ std::memory_order_release,
std::memory_order_relaxed)) {
if (make_iterable_)
allocator_->MakeIterable(ref);
« no previous file with comments | « base/metrics/persistent_memory_allocator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698