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

Unified Diff: content/common/one_writer_seqlock.cc

Issue 14678012: Implement the content/renderer and content/browser part of the Device Motion API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compilation: peer_handle -> PeerHandle() Created 7 years, 5 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 | « content/common/one_writer_seqlock.h ('k') | content/common/shared_memory_seqlock_buffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/one_writer_seqlock.cc
diff --git a/content/common/gamepad_seqlock.cc b/content/common/one_writer_seqlock.cc
similarity index 81%
rename from content/common/gamepad_seqlock.cc
rename to content/common/one_writer_seqlock.cc
index 7f7e14f47e48b120fc70fe02fc4fa73737511216..1494280d4d6915520761f39da3c3bfa01df1b2e3 100644
--- a/content/common/gamepad_seqlock.cc
+++ b/content/common/one_writer_seqlock.cc
@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/common/gamepad_seqlock.h"
+#include "content/common/one_writer_seqlock.h"
namespace content {
-GamepadSeqLock::GamepadSeqLock()
+OneWriterSeqLock::OneWriterSeqLock()
: sequence_(0) {
}
-base::subtle::Atomic32 GamepadSeqLock::ReadBegin() {
+base::subtle::Atomic32 OneWriterSeqLock::ReadBegin() {
base::subtle::Atomic32 version;
for (;;) {
version = base::subtle::NoBarrier_Load(&sequence_);
@@ -26,20 +26,20 @@ base::subtle::Atomic32 GamepadSeqLock::ReadBegin() {
return version;
}
-bool GamepadSeqLock::ReadRetry(base::subtle::Atomic32 version) {
+bool OneWriterSeqLock::ReadRetry(base::subtle::Atomic32 version) {
// If the sequence number was updated then a read should be re-attempted.
// -- Load fence, read membarrier
return base::subtle::Release_Load(&sequence_) != version;
}
-void GamepadSeqLock::WriteBegin() {
+void OneWriterSeqLock::WriteBegin() {
// Increment the sequence number to odd to indicate the beginning of a write
// update.
base::subtle::Barrier_AtomicIncrement(&sequence_, 1);
// -- Store fence, write membarrier
}
-void GamepadSeqLock::WriteEnd() {
+void OneWriterSeqLock::WriteEnd() {
// Increment the sequence to an even number to indicate the completion of
// a write update.
// -- Store fence, write membarrier
« no previous file with comments | « content/common/one_writer_seqlock.h ('k') | content/common/shared_memory_seqlock_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698