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

Unified Diff: chromecast/media/cma/ipc/media_message_fifo.cc

Issue 631283002: Replace Acquire_Store calls with Release_Store as these stores should have the release ordering/sem… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporate review comments Created 6 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/media/cma/ipc/media_message_fifo.cc
diff --git a/chromecast/media/cma/ipc/media_message_fifo.cc b/chromecast/media/cma/ipc/media_message_fifo.cc
index f81bb4c49c23561675c2c998a48fffe4d6e64bcf..9f8ad001dc89d0e4fc679386e0e9ec6abcf38884 100644
--- a/chromecast/media/cma/ipc/media_message_fifo.cc
+++ b/chromecast/media/cma/ipc/media_message_fifo.cc
@@ -123,8 +123,8 @@ MediaMessageFifo::MediaMessageFifo(
desc->size = size_;
internal_rd_offset_ = 0;
internal_wr_offset_ = 0;
- base::subtle::Acquire_Store(rd_offset_, 0);
- base::subtle::Acquire_Store(wr_offset_, 0);
+ base::subtle::Release_Store(rd_offset_, 0);
+ base::subtle::Release_Store(wr_offset_, 0);
} else {
size_ = desc->size;
CHECK_LE(size_, max_size);
@@ -370,9 +370,10 @@ void MediaMessageFifo::CommitRead(size_t new_rd_offset) {
// before updating the read offset.
base::subtle::Release_Store(rd_offset_, new_rd_offset);
- // Make sure the read pointer has been updated before sending a notification.
+ // Since rd_offset_ is updated by a release_store above, any thread that
+ // does acquire_load is guaranteed to see the new rd_offset_ set above.
+ // So it is safe to send the notification.
if (!read_event_cb_.is_null()) {
- base::subtle::MemoryBarrier();
read_event_cb_.Run();
}
}
@@ -382,9 +383,10 @@ void MediaMessageFifo::CommitWrite(size_t new_wr_offset) {
// before updating the write offset.
base::subtle::Release_Store(wr_offset_, new_wr_offset);
- // Make sure the write pointer has been updated before sending a notification.
+ // Since wr_offset_ is updated by a release_store above, any thread that
+ // does acquire_load is guaranteed to see the new wr_offset_ set above.
+ // So it is safe to send the notification.
if (!write_event_cb_.is_null()) {
- base::subtle::MemoryBarrier();
write_event_cb_.Run();
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698