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

Unified Diff: content/common/gamepad_hardware_buffer.h

Issue 8689011: Renderer reading side of gamepad (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: move seqlock to gamepad-specific, improve description Created 9 years, 1 month 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
Index: content/common/gamepad_hardware_buffer.h
diff --git a/content/common/gamepad_hardware_buffer.h b/content/common/gamepad_hardware_buffer.h
index d9845227710fcab6f09880320084a9d403d3f687..2e23bb9c8468099c0856abc7e912cea8425c417d 100644
--- a/content/common/gamepad_hardware_buffer.h
+++ b/content/common/gamepad_hardware_buffer.h
@@ -5,7 +5,7 @@
#ifndef CONTENT_COMMON_GAMEPAD_HARDWARE_BUFFER_H_
#define CONTENT_COMMON_GAMEPAD_HARDWARE_BUFFER_H_
-#include "base/atomicops.h"
+#include "content/common/gamepad_seqlock.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebGamepads.h"
namespace gamepad {
@@ -19,25 +19,13 @@ we want low latency (so would like to avoid explicit communication via IPC
between producer and consumer) and relatively large data size.
Writer and reader operate on the same buffer assuming contention is low, and
-start_marker and end_marker are used to detect inconsistent reads.
-
-The writer atomically increments the start_marker counter before starting,
-then fills in the gamepad data, then increments end_marker to the same value
-as start_marker. The readers first reads end_marker, then the the data and
-then start_marker, and if the reader finds that the start and end markers were
-different, then it must retry as the buffer was updated while being read.
-
-There is a requirement for memory barriers between the accesses to the markers
-and the main data to ensure that both the reader and write see a consistent
-view of those values. In the current implementation, the writer uses an
-Barrier_AtomicIncrement for the counter, and the reader uses an Acquire_Load.
+contention is detected by using the associated SeqLock.
*/
struct GamepadHardwareBuffer {
- base::subtle::Atomic32 start_marker;
+ GamepadSeqLock sequence;
WebKit::WebGamepads buffer;
- base::subtle::Atomic32 end_marker;
};
}

Powered by Google App Engine
This is Rietveld 408576698