Android: Fix potential null-ptr deref
[chromium-blink-merge.git] / content / common / shared_memory_seqlock_buffer.h
blobcee4f5cb702ff5f27aa7de7946ce3bcc93656b09
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_COMMON_SHARED_MEMORY_SEQLOCK_BUFFER_H_
6 #define CONTENT_COMMON_SHARED_MEMORY_SEQLOCK_BUFFER_H_
8 #include "content/common/one_writer_seqlock.h"
10 namespace content {
12 // This structure is stored in shared memory that's shared between the browser
13 // which does the hardware polling, and the consumers of the data,
14 // i.e. the renderers. The performance characteristics are that
15 // we want low latency (so would like to avoid explicit communication via IPC
16 // between producer and consumer) and relatively large data size.
18 // Writer and reader operate on the same buffer assuming contention is low, and
19 // contention is detected by using the associated SeqLock.
21 template<class Data>
22 class SharedMemorySeqLockBuffer {
23 public:
24 OneWriterSeqLock seqlock;
25 Data data;
28 } // namespace content
30 #endif // CONTENT_COMMON_SHARED_MEMORY_SEQLOCK_BUFFER_H_