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

Side by Side Diff: Source/wtf/PartitionAlloc.h

Issue 1315113006: Add partitionsOutOfMemoryUsingXXX to know Blink memory usage from OOM crash reports (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 uintptr_t invertedSelf; 309 uintptr_t invertedSelf;
310 310
311 static int gInitializedLock; 311 static int gInitializedLock;
312 static bool gInitialized; 312 static bool gInitialized;
313 // gSeedPage is used as a sentinel to indicate that there is no page 313 // gSeedPage is used as a sentinel to indicate that there is no page
314 // in the active page list. We can use nullptr, but in that case we need 314 // in the active page list. We can use nullptr, but in that case we need
315 // to add a null-check branch to the hot allocation path. We want to avoid 315 // to add a null-check branch to the hot allocation path. We want to avoid
316 // that. 316 // that.
317 static PartitionPage gSeedPage; 317 static PartitionPage gSeedPage;
318 static PartitionBucket gPagedBucket; 318 static PartitionBucket gPagedBucket;
319 // gMemoryUsageReportFunction is used to know how much memory Blink
320 // has already allocated when OOM occurrs.
321 // Currently Partitions registers this function.
322 static size_t (*gMemoryUsageReportFunction)();
haraken 2015/09/04 05:22:45 Instead of exporting gMemoryUsageReportFunction, h
tasak 2015/09/04 06:12:06 Done.
319 }; 323 };
320 324
321 // Never instantiate a PartitionRoot directly, instead use PartitionAlloc. 325 // Never instantiate a PartitionRoot directly, instead use PartitionAlloc.
322 struct PartitionRoot : public PartitionRootBase { 326 struct PartitionRoot : public PartitionRootBase {
323 // The PartitionAlloc templated class ensures the following is correct. 327 // The PartitionAlloc templated class ensures the following is correct.
324 ALWAYS_INLINE PartitionBucket* buckets() { return reinterpret_cast<Partition Bucket*>(this + 1); } 328 ALWAYS_INLINE PartitionBucket* buckets() { return reinterpret_cast<Partition Bucket*>(this + 1); }
325 ALWAYS_INLINE const PartitionBucket* buckets() const { return reinterpret_ca st<const PartitionBucket*>(this + 1); } 329 ALWAYS_INLINE const PartitionBucket* buckets() const { return reinterpret_ca st<const PartitionBucket*>(this + 1); }
326 }; 330 };
327 331
328 // Never instantiate a PartitionRootGeneric directly, instead use PartitionAlloc atorGeneric. 332 // Never instantiate a PartitionRootGeneric directly, instead use PartitionAlloc atorGeneric.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 // partitionDumpStatsGeneric for using the memory statistics. 380 // partitionDumpStatsGeneric for using the memory statistics.
377 class WTF_EXPORT PartitionStatsDumper { 381 class WTF_EXPORT PartitionStatsDumper {
378 public: 382 public:
379 // Called to dump total memory used by partition, once per partition. 383 // Called to dump total memory used by partition, once per partition.
380 virtual void partitionDumpTotals(const char* partitionName, const PartitionM emoryStats*) = 0; 384 virtual void partitionDumpTotals(const char* partitionName, const PartitionM emoryStats*) = 0;
381 385
382 // Called to dump stats about buckets, for each bucket. 386 // Called to dump stats about buckets, for each bucket.
383 virtual void partitionsDumpBucketStats(const char* partitionName, const Part itionBucketMemoryStats*) = 0; 387 virtual void partitionsDumpBucketStats(const char* partitionName, const Part itionBucketMemoryStats*) = 0;
384 }; 388 };
385 389
390 WTF_EXPORT void partitionAllocGlobalInit(size_t (*memoryUsageReportFunc)());
386 WTF_EXPORT void partitionAllocInit(PartitionRoot*, size_t numBuckets, size_t max Allocation); 391 WTF_EXPORT void partitionAllocInit(PartitionRoot*, size_t numBuckets, size_t max Allocation);
387 WTF_EXPORT bool partitionAllocShutdown(PartitionRoot*); 392 WTF_EXPORT bool partitionAllocShutdown(PartitionRoot*);
388 WTF_EXPORT void partitionAllocGenericInit(PartitionRootGeneric*); 393 WTF_EXPORT void partitionAllocGenericInit(PartitionRootGeneric*);
389 WTF_EXPORT bool partitionAllocGenericShutdown(PartitionRootGeneric*); 394 WTF_EXPORT bool partitionAllocGenericShutdown(PartitionRootGeneric*);
390 395
391 enum PartitionPurgeFlags { 396 enum PartitionPurgeFlags {
392 // Decommitting the ring list of empty pages is reasonably fast. 397 // Decommitting the ring list of empty pages is reasonably fast.
393 PartitionPurgeDecommitEmptyPages = 1 << 0, 398 PartitionPurgeDecommitEmptyPages = 1 << 0,
394 // Discarding unused system pages is slower, because it involves walking all 399 // Discarding unused system pages is slower, because it involves walking all
395 // freelists in all active partition pages of all buckets >= system page 400 // freelists in all active partition pages of all buckets >= system page
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 using WTF::partitionAlloc; 816 using WTF::partitionAlloc;
812 using WTF::partitionFree; 817 using WTF::partitionFree;
813 using WTF::partitionAllocGeneric; 818 using WTF::partitionAllocGeneric;
814 using WTF::partitionFreeGeneric; 819 using WTF::partitionFreeGeneric;
815 using WTF::partitionReallocGeneric; 820 using WTF::partitionReallocGeneric;
816 using WTF::partitionAllocActualSize; 821 using WTF::partitionAllocActualSize;
817 using WTF::partitionAllocSupportsGetSize; 822 using WTF::partitionAllocSupportsGetSize;
818 using WTF::partitionAllocGetSize; 823 using WTF::partitionAllocGetSize;
819 824
820 #endif // WTF_PartitionAlloc_h 825 #endif // WTF_PartitionAlloc_h
OLDNEW
« Source/wtf/Alias.cpp ('K') | « Source/wtf/Alias.cpp ('k') | Source/wtf/PartitionAlloc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698