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

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

Issue 1190173003: PartitionAlloc: API changes to support new partitionPurgeMemoryGeneric() mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review feedback. Created 5 years, 6 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 | « Source/platform/PartitionAllocMemoryDumpProvider.cpp ('k') | Source/wtf/PartitionAlloc.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 344
345 // Struct used to retrieve memory statistics about a partition bucket. Used by 345 // Struct used to retrieve memory statistics about a partition bucket. Used by
346 // PartitionStatsDumper implementation. 346 // PartitionStatsDumper implementation.
347 struct PartitionBucketMemoryStats { 347 struct PartitionBucketMemoryStats {
348 bool isValid; // Used to check if the stats is valid. 348 bool isValid; // Used to check if the stats is valid.
349 bool isDirectMap; // True if this is a direct mapping; size will not be uniq ue. 349 bool isDirectMap; // True if this is a direct mapping; size will not be uniq ue.
350 uint32_t bucketSlotSize; // The size of the slot in bytes. 350 uint32_t bucketSlotSize; // The size of the slot in bytes.
351 uint32_t allocatedPageSize; // Total size the partition page allocated from the system. 351 uint32_t allocatedPageSize; // Total size the partition page allocated from the system.
352 uint32_t activeBytes; // Total active bytes used in the bucket. 352 uint32_t activeBytes; // Total active bytes used in the bucket.
353 uint32_t residentBytes; // Total bytes provisioned in the bucket. 353 uint32_t residentBytes; // Total bytes provisioned in the bucket.
354 uint32_t freeableBytes; // Total bytes that could be decommitted. 354 uint32_t decommittableBytes; // Total bytes that could be decommitted.
355 uint32_t discardableBytes; // Total bytes that could be discarded.
355 uint32_t numFullPages; // Number of pages with all slots allocated. 356 uint32_t numFullPages; // Number of pages with all slots allocated.
356 uint32_t numActivePages; // Number of pages that have at least one provision ed slot. 357 uint32_t numActivePages; // Number of pages that have at least one provision ed slot.
357 uint32_t numEmptyPages; // Number of pages that are empty but not decommitte d. 358 uint32_t numEmptyPages; // Number of pages that are empty but not decommitte d.
358 uint32_t numDecommittedPages; // Number of pages that are empty and decommit ted. 359 uint32_t numDecommittedPages; // Number of pages that are empty and decommit ted.
359 }; 360 };
360 361
361 // Interface that is passed to partitionDumpStats and 362 // Interface that is passed to partitionDumpStats and
362 // partitionDumpStatsGeneric for using the memory statistics. 363 // partitionDumpStatsGeneric for using the memory statistics.
363 class WTF_EXPORT PartitionStatsDumper { 364 class WTF_EXPORT PartitionStatsDumper {
364 public: 365 public:
365 virtual void partitionsDumpBucketStats(const char* partitionName, const Part itionBucketMemoryStats*) = 0; 366 virtual void partitionsDumpBucketStats(const char* partitionName, const Part itionBucketMemoryStats*) = 0;
366 }; 367 };
367 368
368 WTF_EXPORT void partitionAllocInit(PartitionRoot*, size_t numBuckets, size_t max Allocation); 369 WTF_EXPORT void partitionAllocInit(PartitionRoot*, size_t numBuckets, size_t max Allocation);
369 WTF_EXPORT bool partitionAllocShutdown(PartitionRoot*); 370 WTF_EXPORT bool partitionAllocShutdown(PartitionRoot*);
370 WTF_EXPORT void partitionAllocGenericInit(PartitionRootGeneric*); 371 WTF_EXPORT void partitionAllocGenericInit(PartitionRootGeneric*);
371 WTF_EXPORT bool partitionAllocGenericShutdown(PartitionRootGeneric*); 372 WTF_EXPORT bool partitionAllocGenericShutdown(PartitionRootGeneric*);
372 WTF_EXPORT void partitionPurgeMemory(PartitionRoot*); 373
373 WTF_EXPORT void partitionPurgeMemoryGeneric(PartitionRootGeneric*); 374 enum PartitionPurgeFlags {
375 // Decommitting the ring list of empty pages is reasonably fast.
376 PartitionPurgeDecommitEmptyPages = 1 << 0,
377 };
378
379 WTF_EXPORT void partitionPurgeMemory(PartitionRoot*, int);
380 WTF_EXPORT void partitionPurgeMemoryGeneric(PartitionRootGeneric*, int);
374 381
375 WTF_EXPORT NEVER_INLINE void* partitionAllocSlowPath(PartitionRootBase*, int, si ze_t, PartitionBucket*); 382 WTF_EXPORT NEVER_INLINE void* partitionAllocSlowPath(PartitionRootBase*, int, si ze_t, PartitionBucket*);
376 WTF_EXPORT NEVER_INLINE void partitionFreeSlowPath(PartitionPage*); 383 WTF_EXPORT NEVER_INLINE void partitionFreeSlowPath(PartitionPage*);
377 WTF_EXPORT NEVER_INLINE void* partitionReallocGeneric(PartitionRootGeneric*, voi d*, size_t); 384 WTF_EXPORT NEVER_INLINE void* partitionReallocGeneric(PartitionRootGeneric*, voi d*, size_t);
378 385
379 WTF_EXPORT void partitionDumpStats(PartitionRoot*, const char* partitionName, Pa rtitionStatsDumper*); 386 WTF_EXPORT void partitionDumpStats(PartitionRoot*, const char* partitionName, Pa rtitionStatsDumper*);
380 WTF_EXPORT void partitionDumpStatsGeneric(PartitionRootGeneric*, const char* par titionName, PartitionStatsDumper*); 387 WTF_EXPORT void partitionDumpStatsGeneric(PartitionRootGeneric*, const char* par titionName, PartitionStatsDumper*);
381 388
382 ALWAYS_INLINE PartitionFreelistEntry* partitionFreelistMask(PartitionFreelistEnt ry* ptr) 389 ALWAYS_INLINE PartitionFreelistEntry* partitionFreelistMask(PartitionFreelistEnt ry* ptr)
383 { 390 {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 using WTF::partitionAlloc; 738 using WTF::partitionAlloc;
732 using WTF::partitionFree; 739 using WTF::partitionFree;
733 using WTF::partitionAllocGeneric; 740 using WTF::partitionAllocGeneric;
734 using WTF::partitionFreeGeneric; 741 using WTF::partitionFreeGeneric;
735 using WTF::partitionReallocGeneric; 742 using WTF::partitionReallocGeneric;
736 using WTF::partitionAllocActualSize; 743 using WTF::partitionAllocActualSize;
737 using WTF::partitionAllocSupportsGetSize; 744 using WTF::partitionAllocSupportsGetSize;
738 using WTF::partitionAllocGetSize; 745 using WTF::partitionAllocGetSize;
739 746
740 #endif // WTF_PartitionAlloc_h 747 #endif // WTF_PartitionAlloc_h
OLDNEW
« no previous file with comments | « Source/platform/PartitionAllocMemoryDumpProvider.cpp ('k') | Source/wtf/PartitionAlloc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698