| OLD | NEW |
| 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_QUIC_ARENA_SCOPED_PTR_H_ | 11 #ifndef NET_QUIC_CORE_QUIC_ARENA_SCOPED_PTR_H_ |
| 12 #define NET_QUIC_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_utils.h" | 18 #include "net/quic/core/quic_utils.h" |
| 19 | 19 |
| 20 namespace net { | 20 namespace net { |
| 21 | 21 |
| 22 template <typename T> | 22 template <typename T> |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 break; | 200 break; |
| 201 case ConstructFrom::kArena: | 201 case ConstructFrom::kArena: |
| 202 value_ = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(value_) | | 202 value_ = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(value_) | |
| 203 QuicArenaScopedPtr<T>::kFromArenaMask); | 203 QuicArenaScopedPtr<T>::kFromArenaMask); |
| 204 break; | 204 break; |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace net | 208 } // namespace net |
| 209 | 209 |
| 210 #endif // NET_QUIC_QUIC_ARENA_SCOPED_PTR_H_ | 210 #endif // NET_QUIC_CORE_QUIC_ARENA_SCOPED_PTR_H_ |
| OLD | NEW |