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

Side by Side Diff: net/quic/core/quic_arena_scoped_ptr.h

Issue 2599143003: Add a new QUIC platform API quic_aligned.h for the alignment macro definitions. (Closed)
Patch Set: windows Created 3 years, 12 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
« no previous file with comments | « net/quic/core/crypto/aead_base_encrypter.cc ('k') | net/quic/core/quic_framer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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 // unique_ptr-style pointer that stores values that may be from an arena. Takes 5 // unique_ptr-style pointer that stores values that may be from an arena. Takes
6 // up the same storage as the platform's native pointer type. Takes ownership 6 // up the same storage as the platform's native pointer type. Takes ownership
7 // of the value it's constructed with; if holding a value in an arena, and the 7 // of the value it's constructed with; if holding a value in an arena, and the
8 // type has a non-trivial destructor, the arena must outlive the 8 // type has a non-trivial destructor, the arena must outlive the
9 // QuicArenaScopedPtr. Does not support array overloads. 9 // QuicArenaScopedPtr. Does not support array overloads.
10 10
11 #ifndef NET_QUIC_CORE_QUIC_ARENA_SCOPED_PTR_H_ 11 #ifndef NET_QUIC_CORE_QUIC_ARENA_SCOPED_PTR_H_
12 #define NET_QUIC_CORE_QUIC_ARENA_SCOPED_PTR_H_ 12 #define NET_QUIC_CORE_QUIC_ARENA_SCOPED_PTR_H_
13 13
14 #include <cstdint> // for uintptr_t 14 #include <cstdint> // for uintptr_t
15 15
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "net/quic/core/quic_types.h" 18 #include "net/quic/platform/api/quic_aligned.h"
19 19
20 namespace net { 20 namespace net {
21 21
22 template <typename T> 22 template <typename T>
23 class QuicArenaScopedPtr { 23 class QuicArenaScopedPtr {
24 static_assert(QUIC_ALIGN_OF(T*) > 1, 24 static_assert(QUIC_ALIGN_OF(T*) > 1,
25 "QuicArenaScopedPtr can only store objects that are aligned to " 25 "QuicArenaScopedPtr can only store objects that are aligned to "
26 "greater than 1 byte."); 26 "greater than 1 byte.");
27 27
28 public: 28 public:
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 case ConstructFrom::kArena: 200 case ConstructFrom::kArena:
201 value_ = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(value_) | 201 value_ = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(value_) |
202 QuicArenaScopedPtr<T>::kFromArenaMask); 202 QuicArenaScopedPtr<T>::kFromArenaMask);
203 break; 203 break;
204 } 204 }
205 } 205 }
206 206
207 } // namespace net 207 } // namespace net
208 208
209 #endif // NET_QUIC_CORE_QUIC_ARENA_SCOPED_PTR_H_ 209 #endif // NET_QUIC_CORE_QUIC_ARENA_SCOPED_PTR_H_
OLDNEW
« no previous file with comments | « net/quic/core/crypto/aead_base_encrypter.cc ('k') | net/quic/core/quic_framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698