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

Unified Diff: content/common/one_writer_seqlock.h

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/gamepad_seqlock.cc ('k') | content/common/one_writer_seqlock.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/one_writer_seqlock.h
diff --git a/content/common/gamepad_seqlock.h b/content/common/one_writer_seqlock.h
similarity index 73%
rename from content/common/gamepad_seqlock.h
rename to content/common/one_writer_seqlock.h
index 35f51e58d39d6ea6ef4401fca9441907788e16b8..6774df6c0156a467041dd8c29445bcc85777cea5 100644
--- a/content/common/gamepad_seqlock.h
+++ b/content/common/one_writer_seqlock.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_COMMON_GAMEPAD_SEQLOCK_H_
-#define CONTENT_COMMON_GAMEPAD_SEQLOCK_H_
+#ifndef CONTENT_COMMON_ONE_WRITER_SEQLOCK_H_
+#define CONTENT_COMMON_ONE_WRITER_SEQLOCK_H_
#include "base/atomicops.h"
#include "base/threading/platform_thread.h"
@@ -18,9 +18,9 @@ namespace content {
// http://www.concurrencykit.org/doc/ck_sequence.html
// This implementation is based on ck_sequence.h from http://concurrencykit.org.
//
-// Currently, this is used in only one location. It may make sense to
-// generalize with a higher-level construct that owns both the lock and the
-// data buffer, if it is to be used more widely.
+// Currently this type of lock is used in two implementations (gamepad and
+// device motion, in particular see e.g. shared_memory_seqlock_buffer.h).
+// It may make sense to generalize this lock to multiple writers.
//
// You must be very careful not to operate on potentially inconsistent read
// buffers. If the read must be retry'd, the data in the read buffer could
@@ -28,9 +28,9 @@ namespace content {
// garbage, or indices could be out of range. Probably the only suitable thing
// to do during the read loop is to make a copy of the data, and operate on it
// only after the read was found to be consistent.
-class CONTENT_EXPORT GamepadSeqLock {
+class CONTENT_EXPORT OneWriterSeqLock {
public:
- GamepadSeqLock();
+ OneWriterSeqLock();
base::subtle::Atomic32 ReadBegin();
bool ReadRetry(base::subtle::Atomic32 version);
void WriteBegin();
@@ -38,9 +38,9 @@ class CONTENT_EXPORT GamepadSeqLock {
private:
base::subtle::Atomic32 sequence_;
- DISALLOW_COPY_AND_ASSIGN(GamepadSeqLock);
+ DISALLOW_COPY_AND_ASSIGN(OneWriterSeqLock);
};
} // namespace content
-#endif // CONTENT_COMMON_GAMEPAD_SEQLOCK_H_
+#endif // CONTENT_COMMON_ONE_WRITER_SEQLOCK_H_
« no previous file with comments | « content/common/gamepad_seqlock.cc ('k') | content/common/one_writer_seqlock.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698