17dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// Copyright 2013 The Chromium Authors. All rights reserved.
27dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// Use of this source code is governed by a BSD-style license that can be
37dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// found in the LICENSE file.
47dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
57dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#ifndef CONTENT_COMMON_SHARED_MEMORY_SEQLOCK_BUFFER_H_
67dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#define CONTENT_COMMON_SHARED_MEMORY_SEQLOCK_BUFFER_H_
77dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
87dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "content/common/one_writer_seqlock.h"
97dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
107dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochnamespace content {
117dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
127dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// This structure is stored in shared memory that's shared between the browser
137dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// which does the hardware polling, and the consumers of the data,
147dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// i.e. the renderers. The performance characteristics are that
157dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// we want low latency (so would like to avoid explicit communication via IPC
167dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// between producer and consumer) and relatively large data size.
177dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch//
187dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// Writer and reader operate on the same buffer assuming contention is low, and
197dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// contention is detected by using the associated SeqLock.
207dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
217dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochtemplate<class Data>
227dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochclass SharedMemorySeqLockBuffer {
237dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch public:
247dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  OneWriterSeqLock seqlock;
257dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  Data data;
267dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch};
277dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
287dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch}  // namespace content
297dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
307dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#endif  // CONTENT_COMMON_SHARED_MEMORY_SEQLOCK_BUFFER_H_
31