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

Unified Diff: Source/wtf/Assertions.cpp

Issue 23494018: Add optional parameter to WTFReportBacktrace for stackframe count (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add comment explaining why alloca is being used Created 7 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 | « Source/wtf/Assertions.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/Assertions.cpp
diff --git a/Source/wtf/Assertions.cpp b/Source/wtf/Assertions.cpp
index f7884df401262723d6b59a4c704cdec2c40f3f06..5873c517b6a0eed17c601e381cf2520707c09f6f 100644
--- a/Source/wtf/Assertions.cpp
+++ b/Source/wtf/Assertions.cpp
@@ -249,11 +249,11 @@ void WTFGetBacktrace(void** stack, int* size)
#endif
}
-void WTFReportBacktrace()
+void WTFReportBacktrace(int framesToShow)
{
- static const int framesToShow = 31;
static const int framesToSkip = 2;
- void* samples[framesToShow + framesToSkip];
+ // Use alloca to allocate on the stack since this function is used in OOM situations.
+ void** samples = static_cast<void**>(alloca((framesToShow + framesToSkip) * sizeof(void *)));
int frames = framesToShow + framesToSkip;
WTFGetBacktrace(samples, &frames);
« no previous file with comments | « Source/wtf/Assertions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698