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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/process_util_mac.mm » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This file/namespace contains utility functions for enumerating, ending and 5 // This file/namespace contains utility functions for enumerating, ending and
6 // computing statistics of processes. 6 // computing statistics of processes.
7 7
8 #ifndef BASE_PROCESS_UTIL_H_ 8 #ifndef BASE_PROCESS_UTIL_H_
9 #define BASE_PROCESS_UTIL_H_ 9 #define BASE_PROCESS_UTIL_H_
10 10
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 // Note: Returns true on Windows 2000 without doing anything. 835 // Note: Returns true on Windows 2000 without doing anything.
836 BASE_EXPORT bool EnableLowFragmentationHeap(); 836 BASE_EXPORT bool EnableLowFragmentationHeap();
837 837
838 // Enables 'terminate on heap corruption' flag. Helps protect against heap 838 // Enables 'terminate on heap corruption' flag. Helps protect against heap
839 // overflow. Has no effect if the OS doesn't provide the necessary facility. 839 // overflow. Has no effect if the OS doesn't provide the necessary facility.
840 BASE_EXPORT void EnableTerminationOnHeapCorruption(); 840 BASE_EXPORT void EnableTerminationOnHeapCorruption();
841 841
842 // Turns on process termination if memory runs out. 842 // Turns on process termination if memory runs out.
843 BASE_EXPORT void EnableTerminationOnOutOfMemory(); 843 BASE_EXPORT void EnableTerminationOnOutOfMemory();
844 844
845 #if defined(OS_MACOSX)
846 // Exposed for testing.
847 BASE_EXPORT malloc_zone_t* GetPurgeableZone();
848 #endif // defined(OS_MACOSX)
849
850 // Enables stack dump to console output on exception and signals. 845 // Enables stack dump to console output on exception and signals.
851 // When enabled, the process will quit immediately. This is meant to be used in 846 // When enabled, the process will quit immediately. This is meant to be used in
852 // unit_tests only! This is not thread-safe: only call from main thread. 847 // unit_tests only! This is not thread-safe: only call from main thread.
853 BASE_EXPORT bool EnableInProcessStackDumping(); 848 BASE_EXPORT bool EnableInProcessStackDumping();
854 849
855 // If supported on the platform, and the user has sufficent rights, increase 850 // If supported on the platform, and the user has sufficent rights, increase
856 // the current process's scheduling priority to a high priority. 851 // the current process's scheduling priority to a high priority.
857 BASE_EXPORT void RaiseProcessToHighPriority(); 852 BASE_EXPORT void RaiseProcessToHighPriority();
858 853
859 #if defined(OS_MACOSX) 854 #if defined(OS_MACOSX)
860 // Restore the default exception handler, setting it to Apple Crash Reporter 855 // Restore the default exception handler, setting it to Apple Crash Reporter
861 // (ReportCrash). When forking and execing a new process, the child will 856 // (ReportCrash). When forking and execing a new process, the child will
862 // inherit the parent's exception ports, which may be set to the Breakpad 857 // inherit the parent's exception ports, which may be set to the Breakpad
863 // instance running inside the parent. The parent's Breakpad instance should 858 // instance running inside the parent. The parent's Breakpad instance should
864 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler 859 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler
865 // in the child after forking will restore the standard exception handler. 860 // in the child after forking will restore the standard exception handler.
866 // See http://crbug.com/20371/ for more details. 861 // See http://crbug.com/20371/ for more details.
867 void RestoreDefaultExceptionHandler(); 862 void RestoreDefaultExceptionHandler();
868 #endif // defined(OS_MACOSX) 863 #endif // defined(OS_MACOSX)
869 864
865 #if defined(OS_MACOSX)
866 // Very large images or svg canvases can cause huge mallocs. Skia
867 // does tricks on tcmalloc-based systems to allow malloc to fail with
868 // a NULL rather than hit the oom crasher. This replicates that for
869 // OSX.
870 //
871 // IF YOU USE THIS WITHOUT CONSULTING YOUR FRIENDLY OSX DEVELOPER,
872 // YOUR CODE IS LIKELY TO BE REVERTED. THANK YOU.
873 //
874 // TODO(shess): Weird place to put it, but this is where the OOM
875 // killer currently lives.
876 BASE_EXPORT void* UncheckedMalloc(size_t size);
877 #endif // defined(OS_MACOSX)
878
870 } // namespace base 879 } // namespace base
871 880
872 #endif // BASE_PROCESS_UTIL_H_ 881 #endif // BASE_PROCESS_UTIL_H_
OLDNEW
« 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