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

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

Issue 2193073003: Move shared files in net/quic/ into net/quic/core/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: io_thread_unittest.cc Created 4 years, 4 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 (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 // An arena that consists of a single inlined block of |ArenaSize|. Useful to 5 // An arena that consists of a single inlined block of |ArenaSize|. Useful to
6 // avoid repeated calls to malloc/new and to improve memory locality. DCHECK's 6 // avoid repeated calls to malloc/new and to improve memory locality. DCHECK's
7 // if an allocation out of the arena ever fails in debug builds; falls back to 7 // if an allocation out of the arena ever fails in debug builds; falls back to
8 // heap allocation in release builds. 8 // heap allocation in release builds.
9 9
10 #ifndef NET_QUIC_QUIC_ONE_BLOCK_ARENA_H_ 10 #ifndef NET_QUIC_QUIC_ONE_BLOCK_ARENA_H_
11 #define NET_QUIC_QUIC_ONE_BLOCK_ARENA_H_ 11 #define NET_QUIC_QUIC_ONE_BLOCK_ARENA_H_
12 12
13 #include "net/quic/quic_arena_scoped_ptr.h" 13 #include "net/quic/core/quic_arena_scoped_ptr.h"
14 #include "net/quic/quic_flags.h" 14 #include "net/quic/core/quic_flags.h"
15 #include "net/quic/quic_utils.h" 15 #include "net/quic/core/quic_utils.h"
16 16
17 #define PREDICT_FALSE(x) x 17 #define PREDICT_FALSE(x) x
18 18
19 namespace net { 19 namespace net {
20 20
21 template <uint32_t ArenaSize> 21 template <uint32_t ArenaSize>
22 class QuicOneBlockArena { 22 class QuicOneBlockArena {
23 static const uint32_t kMaxAlign = 8; 23 static const uint32_t kMaxAlign = 8;
24 24
25 public: 25 public:
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 void* buf = &storage_[offset_]; 68 void* buf = &storage_[offset_];
69 new (buf) T(std::forward<Args>(args)...); 69 new (buf) T(std::forward<Args>(args)...);
70 offset_ += AlignedSize<T>(); 70 offset_ += AlignedSize<T>();
71 return QuicArenaScopedPtr<T>(buf, 71 return QuicArenaScopedPtr<T>(buf,
72 QuicArenaScopedPtr<T>::ConstructFrom::kArena); 72 QuicArenaScopedPtr<T>::ConstructFrom::kArena);
73 } 73 }
74 74
75 } // namespace net 75 } // namespace net
76 76
77 #endif // NET_QUIC_QUIC_ONE_BLOCK_ARENA_H_ 77 #endif // NET_QUIC_QUIC_ONE_BLOCK_ARENA_H_
OLDNEW
« no previous file with comments | « net/quic/core/quic_multipath_transmissions_map_test.cc ('k') | net/quic/core/quic_one_block_arena_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698