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

Unified Diff: base/process_util.h

Issue 10908245: unchecked_malloc() for Skia on OSX. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Put EBADF/syslog commentary back. Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/process_util_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process_util.h
diff --git a/base/process_util.h b/base/process_util.h
index cf358dc9c129bead0cd163603d1d74e1449f2b9d..3fb7e2baa95a173f377973e29ca81a11203d47fb 100644
--- a/base/process_util.h
+++ b/base/process_util.h
@@ -842,11 +842,6 @@ BASE_EXPORT void EnableTerminationOnHeapCorruption();
// Turns on process termination if memory runs out.
BASE_EXPORT void EnableTerminationOnOutOfMemory();
-#if defined(OS_MACOSX)
-// Exposed for testing.
-BASE_EXPORT malloc_zone_t* GetPurgeableZone();
-#endif // defined(OS_MACOSX)
-
// Enables stack dump to console output on exception and signals.
// When enabled, the process will quit immediately. This is meant to be used in
// unit_tests only! This is not thread-safe: only call from main thread.
@@ -867,6 +862,20 @@ BASE_EXPORT void RaiseProcessToHighPriority();
void RestoreDefaultExceptionHandler();
#endif // defined(OS_MACOSX)
+#if defined(OS_MACOSX)
+// Very large images or svg canvases can cause huge mallocs. Skia
+// does tricks on tcmalloc-based systems to allow malloc to fail with
+// a NULL rather than hit the oom crasher. This replicates that for
+// OSX.
+//
+// IF YOU USE THIS WITHOUT CONSULTING YOUR FRIENDLY OSX DEVELOPER,
+// YOUR CODE IS LIKELY TO BE REVERTED. THANK YOU.
+//
+// TODO(shess): Weird place to put it, but this is where the OOM
+// killer currently lives.
+BASE_EXPORT void* UncheckedMalloc(size_t size);
+#endif // defined(OS_MACOSX)
+
} // namespace base
#endif // BASE_PROCESS_UTIL_H_
« no previous file with comments | « no previous file | base/process_util_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698