summaryrefslogtreecommitdiffstats
path: root/third_party/apple_apsl
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-21 17:55:38 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-21 17:55:38 +0000
commitd4166424a498ede682244be90a63d1b5938ee000 (patch)
tree63c200dae2074b65bf436dd38452dba6eef56dec /third_party/apple_apsl
parent8c5296a3dfd62201e6a47060ab322ed355a81c61 (diff)
downloadchromium_src-d4166424a498ede682244be90a63d1b5938ee000.zip
chromium_src-d4166424a498ede682244be90a63d1b5938ee000.tar.gz
chromium_src-d4166424a498ede682244be90a63d1b5938ee000.tar.bz2
Update OOM killer with Lion info.
BUG=74589 TEST=none; still works on Lion Review URL: http://codereview.chromium.org/7471041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93436 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/apple_apsl')
-rw-r--r--third_party/apple_apsl/CFBase.h52
-rw-r--r--third_party/apple_apsl/README.chromium13
-rw-r--r--third_party/apple_apsl/malloc.h11
3 files changed, 41 insertions, 35 deletions
diff --git a/third_party/apple_apsl/CFBase.h b/third_party/apple_apsl/CFBase.h
index 7942966..f7ecaf6 100644
--- a/third_party/apple_apsl/CFBase.h
+++ b/third_party/apple_apsl/CFBase.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2011 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
@@ -21,7 +21,7 @@
* @APPLE_LICENSE_HEADER_END@
*/
/* CFBase.c
- Copyright (c) 1998-2009, Apple Inc. All rights reserved.
+ Copyright (c) 1998-2011, Apple Inc. All rights reserved.
Responsibility: Christopher Kane
*/
@@ -50,29 +50,33 @@ struct ChromeCFAllocatorLeopards {
CFAllocatorContext _context;
};
-// TODO(avi): update upon source release; http://crbug.com/74589
struct ChromeCFAllocatorLion {
- ChromeCFRuntimeBase _base;
- // CFAllocator in Darwin 9 included a complete copy of _malloc_zone_t. The
- // version in Darwin 10 had an abbreviated _malloc_zone_t that ended after the
- // version/"reserved" field (see above). Darwin 11 appears to have a truncated
- // _malloc_zone_t as well, but two fields larger than 9/10.
- void* presumedSizeFunctionPtr;
- void* presumedMallocFunctionPtr;
- void* presumedCallocFunctionPtr;
- void* presumedVallocFunctionPtr;
- void* presumedFreeFunctionPtr;
- void* presumedReallocFunctionPtr;
- void* presumedDestroyFunctionPtr;
- const char *zone_name;
- void* presumedBatchMallocFunctionPtr;
- void* presumedBatchFreeFunctionPtr;
- void* presumedIntrospectStructPtr;
- void* presumedReservedSlashVersion; // always 6 in CFAllocators
- void* presumedMemalignFunctionPtr;
- void* presumedFreeDefiniteSizeFunctionPtr;
- CFAllocatorRef _allocator;
- CFAllocatorContext _context;
+ ChromeCFRuntimeBase _base;
+#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED
+ size_t (*size)(struct _malloc_zone_t *zone, const void *ptr); /* returns the size of a block or 0 if not in this zone; must be fast, especially for negative answers */
+ void *(*malloc)(struct _malloc_zone_t *zone, size_t size);
+ void *(*calloc)(struct _malloc_zone_t *zone, size_t num_items, size_t size); /* same as malloc, but block returned is set to zero */
+ void *(*valloc)(struct _malloc_zone_t *zone, size_t size); /* same as malloc, but block returned is set to zero and is guaranteed to be page aligned */
+ void (*free)(struct _malloc_zone_t *zone, void *ptr);
+ void *(*realloc)(struct _malloc_zone_t *zone, void *ptr, size_t size);
+ void (*destroy)(struct _malloc_zone_t *zone); /* zone is destroyed and all memory reclaimed */
+ const char *zone_name;
+
+ /* Optional batch callbacks; these may be NULL */
+ unsigned (*batch_malloc)(struct _malloc_zone_t *zone, size_t size, void **results, unsigned num_requested); /* given a size, returns pointers capable of holding that size; returns the number of pointers allocated (maybe 0 or less than num_requested) */
+ void (*batch_free)(struct _malloc_zone_t *zone, void **to_be_freed, unsigned num_to_be_freed); /* frees all the pointers in to_be_freed; note that to_be_freed may be overwritten during the process */
+
+ struct malloc_introspection_t *introspect;
+ unsigned version;
+
+ /* aligned memory allocation. The callback may be NULL. */
+ void *(*memalign)(struct _malloc_zone_t *zone, size_t alignment, size_t size);
+
+ /* free a pointer known to be in zone and known to have the given size. The callback may be NULL. */
+ void (*free_definite_size)(struct _malloc_zone_t *zone, void *ptr, size_t size);
+#endif
+ CFAllocatorRef _allocator;
+ CFAllocatorContext _context;
};
#endif // THIRD_PARTY_APPLE_APSL_CFBASE_H_
diff --git a/third_party/apple_apsl/README.chromium b/third_party/apple_apsl/README.chromium
index 2f014a2..424d77c 100644
--- a/third_party/apple_apsl/README.chromium
+++ b/third_party/apple_apsl/README.chromium
@@ -6,16 +6,15 @@ Security Critical: yes
Four files are excerpted here:
malloc.h from:
-http://www.opensource.apple.com/source/Libc/Libc-583/include/malloc/malloc.h
+http://www.opensource.apple.com/source/Libc/Libc-763.11/include/malloc/malloc.h
Modifications:
- Modified #ifdef guards.
- Removed everything but the definition of malloc_zone_t.
- Renamed _malloc_zone_t to ChromeMallocZone to avoid possible name conflicts.
-- Added a few comments.
CFRuntime.h from:
-http://www.opensource.apple.com/source/CF/CF-550/CFRuntime.h
+http://www.opensource.apple.com/source/CF/CF-635/CFRuntime.h
Modifications:
- Modified #ifdef guards.
@@ -23,7 +22,8 @@ Modifications:
- Renamed CFRuntimeBase to ChromeCFRuntimeBase to avoid possible name conflicts.
CFBase.h from:
-http://opensource.apple.com/source/CF/CF-550/CFBase.c
+http://www.opensource.apple.com/source/CF/CF-550/CFBase.c
+http://www.opensource.apple.com/source/CF/CF-635/CFBase.c
Modifications:
- Renamed the file to CFBase.h.
@@ -31,9 +31,8 @@ Modifications:
- Added an #include of the CFRuntime.h file.
- Removed everything but the definition of __CFAllocator.
- Modified the reference of CFRuntimeBase to ChromeCFRuntimeBase.
-- Renamed __CFAllocator to ChromeCFAllocatorLeopards to avoid possible name
- conflicts.
-- Added a presumed definition of ChromeCFAllocatorLion.
+- Renamed __CFAllocator to ChromeCFAllocatorLeopards (from CF-550) and to
+ ChromeCFAllocatorLion (from CF-635) to avoid possible name conflicts.
cssmapplePriv.h from:
http://www.opensource.apple.com/source/libsecurity_cssm/libsecurity_cssm-31536/lib/cssmapplePriv.h
diff --git a/third_party/apple_apsl/malloc.h b/third_party/apple_apsl/malloc.h
index a5a409f..9fd1d5d 100644
--- a/third_party/apple_apsl/malloc.h
+++ b/third_party/apple_apsl/malloc.h
@@ -45,11 +45,14 @@ typedef struct _ChromeMallocZone {
struct malloc_introspection_t *introspect;
unsigned version;
- /* aligned memory allocation. The callback may be NULL. */
- void *(*memalign)(struct _malloc_zone_t *zone, size_t alignment, size_t size); // version >= 5
+ /* aligned memory allocation. The callback may be NULL. Present in version >= 5. */
+ void *(*memalign)(struct _malloc_zone_t *zone, size_t alignment, size_t size);
- /* free a pointer known to be in zone and known to have the given size. The callback may be NULL. */
- void (*free_definite_size)(struct _malloc_zone_t *zone, void *ptr, size_t size); // version >= 6
+ /* free a pointer known to be in zone and known to have the given size. The callback may be NULL. Present in version >= 6.*/
+ void (*free_definite_size)(struct _malloc_zone_t *zone, void *ptr, size_t size);
+
+ /* Empty out caches in the face of memory pressure. The callback may be NULL. Present in version >= 8. */
+ size_t (*pressure_relief)(struct _malloc_zone_t *zone, size_t goal);
} ChromeMallocZone;
#endif // THIRD_PARTY_APPLE_APSL_MALLOC_H_