Index: components/shared_memory_seqlock/shared_memory_seqlock_reader.h |
diff --git a/content/renderer/shared_memory_seqlock_reader.h b/components/shared_memory_seqlock/shared_memory_seqlock_reader.h |
similarity index 58% |
rename from content/renderer/shared_memory_seqlock_reader.h |
rename to components/shared_memory_seqlock/shared_memory_seqlock_reader.h |
index 7fd7beb95bbcb951d82ac333d7fd75237eb060de..c8000b78c8b61d565aff9c72b09131bf512dd1bb 100644 |
--- a/content/renderer/shared_memory_seqlock_reader.h |
+++ b/components/shared_memory_seqlock/shared_memory_seqlock_reader.h |
@@ -2,28 +2,30 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CONTENT_RENDERER_SHARED_MEMORY_SEQLOCK_READER_H_ |
-#define CONTENT_RENDERER_SHARED_MEMORY_SEQLOCK_READER_H_ |
+#ifndef COMPONENTS_SHARED_MEMORY_SEQLOCK_SHARED_MEMORY_SEQLOCK_READER_H_ |
+#define COMPONENTS_SHARED_MEMORY_SEQLOCK_SHARED_MEMORY_SEQLOCK_READER_H_ |
#include "base/logging.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/shared_memory.h" |
-#include "content/common/shared_memory_seqlock_buffer.h" |
+#include "components/shared_memory_seqlock/shared_memory_seqlock_buffer.h" |
-namespace content { |
+namespace shared_memory_seqlock { |
namespace internal { |
-class SharedMemorySeqLockReaderBase { |
+class SharedMemorySeqLockReaderBase { |
protected: |
SharedMemorySeqLockReaderBase(); |
virtual ~SharedMemorySeqLockReaderBase(); |
- void* InitializeSharedMemory( |
- base::SharedMemoryHandle shared_memory_handle, |
- size_t buffer_size); |
+ void* InitializeSharedMemory(base::SharedMemoryHandle shared_memory_handle, |
+ size_t buffer_size); |
- bool FetchFromBuffer(content::OneWriterSeqLock* seqlock, void* final, |
- void* temp, void* from, size_t size); |
+ bool FetchFromBuffer(shared_memory_seqlock::OneWriterSeqLock* seqlock, |
+ void* final, |
+ void* temp, |
+ void* from, |
+ size_t size); |
static const int kMaximumContentionCount = 10; |
base::SharedMemoryHandle renderer_shared_memory_handle_; |
@@ -34,23 +36,23 @@ class SharedMemorySeqLockReaderBase { |
// Template argument Data should be a pod-like structure only containing |
// data fields, such that it is copyable by memcpy method. |
-template<typename Data> |
+template <typename Data> |
class SharedMemorySeqLockReader |
: private internal::SharedMemorySeqLockReaderBase { |
public: |
- SharedMemorySeqLockReader() : buffer_(0) { } |
- virtual ~SharedMemorySeqLockReader() { } |
+ SharedMemorySeqLockReader() : buffer_(0) {} |
+ virtual ~SharedMemorySeqLockReader() {} |
bool GetLatestData(Data* data) { |
DCHECK(buffer_); |
DCHECK(sizeof(*data) == sizeof(*temp_buffer_)); |
return FetchFromBuffer(&buffer_->seqlock, data, temp_buffer_.get(), |
- &buffer_->data, sizeof(*temp_buffer_)); |
+ &buffer_->data, sizeof(*temp_buffer_)); |
} |
bool Initialize(base::SharedMemoryHandle shared_memory_handle) { |
if (void* memory = InitializeSharedMemory( |
- shared_memory_handle, sizeof(SharedMemorySeqLockBuffer<Data>))) { |
+ shared_memory_handle, sizeof(SharedMemorySeqLockBuffer<Data>))) { |
buffer_ = static_cast<SharedMemorySeqLockBuffer<Data>*>(memory); |
temp_buffer_.reset(new Data); |
return true; |
@@ -65,6 +67,6 @@ class SharedMemorySeqLockReader |
DISALLOW_COPY_AND_ASSIGN(SharedMemorySeqLockReader); |
}; |
-} // namespace content |
+} // namespace shared_memory_seqlock |
-#endif // CONTENT_RENDERER_SHARED_MEMORY_SEQLOCK_READER_H_ |
+#endif // COMPONENTS_SHARED_MEMORY_SEQLOCK_SHARED_MEMORY_SEQLOCK_READER_H_ |