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

Side by Side Diff: content/renderer/devtools/lock_free_circular_queue.h

Issue 2670873002: Remove base's ALIGNOF/ALIGNAS in favor of alignof/alignas. (Closed)
Patch Set: rebase Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_DEVTOOLS_LOCK_FREE_CIRCULAR_QUEUE_H_ 5 #ifndef CONTENT_RENDERER_DEVTOOLS_LOCK_FREE_CIRCULAR_QUEUE_H_
6 #define CONTENT_RENDERER_DEVTOOLS_LOCK_FREE_CIRCULAR_QUEUE_H_ 6 #define CONTENT_RENDERER_DEVTOOLS_LOCK_FREE_CIRCULAR_QUEUE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/atomicops.h" 10 #include "base/atomicops.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/aligned_memory.h" 12 #include "base/memory/aligned_memory.h"
13 13
14 #define CACHELINE_ALIGNED ALIGNAS(64) 14 #define CACHELINE_ALIGNED alignas(64)
15 15
16 namespace content { 16 namespace content {
17 17
18 MSVC_PUSH_DISABLE_WARNING(4324) // structure was padded due to align 18 MSVC_PUSH_DISABLE_WARNING(4324) // structure was padded due to align
19 19
20 // Lock-free cache-friendly sampling circular queue for large 20 // Lock-free cache-friendly sampling circular queue for large
21 // records. Intended for fast transfer of large records between a 21 // records. Intended for fast transfer of large records between a
22 // single producer and a single consumer. If the queue is full, 22 // single producer and a single consumer. If the queue is full,
23 // StartEnqueue will return nullptr. The queue is designed with 23 // StartEnqueue will return nullptr. The queue is designed with
24 // a goal in mind to evade cache lines thrashing by preventing 24 // a goal in mind to evade cache lines thrashing by preventing
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 Entry* entry) { 118 Entry* entry) {
119 Entry* next = entry + 1; 119 Entry* next = entry + 1;
120 if (next == &buffer_[L]) 120 if (next == &buffer_[L])
121 return buffer_; 121 return buffer_;
122 return next; 122 return next;
123 } 123 }
124 124
125 template <typename T, unsigned L> 125 template <typename T, unsigned L>
126 void* LockFreeCircularQueue<T, L>::operator new(size_t size) { 126 void* LockFreeCircularQueue<T, L>::operator new(size_t size) {
127 typedef LockFreeCircularQueue<T, L> QueueTypeAlias; 127 typedef LockFreeCircularQueue<T, L> QueueTypeAlias;
128 return base::AlignedAlloc(size, ALIGNOF(QueueTypeAlias)); 128 return base::AlignedAlloc(size, alignof(QueueTypeAlias));
129 } 129 }
130 130
131 template <typename T, unsigned L> 131 template <typename T, unsigned L>
132 void LockFreeCircularQueue<T, L>::operator delete(void* ptr) { 132 void LockFreeCircularQueue<T, L>::operator delete(void* ptr) {
133 base::AlignedFree(ptr); 133 base::AlignedFree(ptr);
134 } 134 }
135 135
136 } // namespace content 136 } // namespace content
137 137
138 #endif // CONTENT_RENDERER_DEVTOOLS_LOCK_FREE_CIRCULAR_QUEUE_H_ 138 #endif // CONTENT_RENDERER_DEVTOOLS_LOCK_FREE_CIRCULAR_QUEUE_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/audio_input_sync_writer_unittest.cc ('k') | media/base/audio_parameters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698