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

Side by Side Diff: base/allocator/partition_allocator/partition_alloc.h

Issue 2288473002: Implement Dump-on-DCHECK (via a new LogSeverity). (Closed)
Patch Set: Fix test Created 3 years, 11 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 | « no previous file | base/logging.h » ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_H 5 #ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_H
6 #define BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_H 6 #define BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_H
7 7
8 // DESCRIPTION 8 // DESCRIPTION
9 // partitionAlloc() / PartitionAllocGeneric() and PartitionFree() / 9 // partitionAlloc() / PartitionAllocGeneric() and PartitionFree() /
10 // PartitionFreeGeneric() are approximately analagous to malloc() and free(). 10 // PartitionFreeGeneric() are approximately analagous to malloc() and free().
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 uintptr_t masked = ByteSwapUintPtrT(reinterpret_cast<uintptr_t>(ptr)); 500 uintptr_t masked = ByteSwapUintPtrT(reinterpret_cast<uintptr_t>(ptr));
501 #endif 501 #endif
502 return reinterpret_cast<PartitionFreelistEntry*>(masked); 502 return reinterpret_cast<PartitionFreelistEntry*>(masked);
503 } 503 }
504 504
505 ALWAYS_INLINE size_t PartitionCookieSizeAdjustAdd(size_t size) { 505 ALWAYS_INLINE size_t PartitionCookieSizeAdjustAdd(size_t size) {
506 #if DCHECK_IS_ON() 506 #if DCHECK_IS_ON()
507 // Add space for cookies, checking for integer overflow. TODO(palmer): 507 // Add space for cookies, checking for integer overflow. TODO(palmer):
508 // Investigate the performance and code size implications of using 508 // Investigate the performance and code size implications of using
509 // CheckedNumeric throughout PA. 509 // CheckedNumeric throughout PA.
510 DCHECK(size + (2 * kCookieSize) > size); 510 CHECK(size + (2 * kCookieSize) > size);
Nico 2017/01/17 13:03:41 You lost me in the first file already. Why do we h
511 size += 2 * kCookieSize; 511 size += 2 * kCookieSize;
512 #endif 512 #endif
513 return size; 513 return size;
514 } 514 }
515 515
516 ALWAYS_INLINE size_t PartitionCookieSizeAdjustSubtract(size_t size) { 516 ALWAYS_INLINE size_t PartitionCookieSizeAdjustSubtract(size_t size) {
517 #if DCHECK_IS_ON() 517 #if DCHECK_IS_ON()
518 // Remove space for cookies. 518 // Remove space for cookies.
519 DCHECK(size >= 2 * kCookieSize); 519 DCHECK(size >= 2 * kCookieSize);
520 size -= 2 * kCookieSize; 520 size -= 2 * kCookieSize;
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 void init() { PartitionAllocGenericInit(&partition_root_); } 896 void init() { PartitionAllocGenericInit(&partition_root_); }
897 ALWAYS_INLINE PartitionRootGeneric* root() { return &partition_root_; } 897 ALWAYS_INLINE PartitionRootGeneric* root() { return &partition_root_; }
898 898
899 private: 899 private:
900 PartitionRootGeneric partition_root_; 900 PartitionRootGeneric partition_root_;
901 }; 901 };
902 902
903 } // namespace base 903 } // namespace base
904 904
905 #endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_H 905 #endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_H
OLDNEW
« no previous file with comments | « no previous file | base/logging.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698