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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp

Issue 2130293003: Change OOMs to raise custom exception rather than breakpoint on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 years, 5 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 | « skia/ext/SkMemory_new_handler.cpp ('k') | third_party/WebKit/Source/platform/heap/PageMemory.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
index 35d5d5ee5cd59a950e9271c596e920f3a4513bbb..6323308b92a65a97eee04e2247b1aca7d9442916 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
@@ -92,10 +92,17 @@ static Frame* findFrame(v8::Isolate* isolate, v8::Local<v8::Object> host, v8::Lo
static void reportFatalErrorInMainThread(const char* location, const char* message)
{
int memoryUsageMB = Platform::current()->actualMemoryUsageMB();
- printf("V8 error: %s (%s). Current memory usage: %d MB\n", message, location, memoryUsageMB);
+ DVLOG(1) << "V8 error: " << message << " (" << location << "). Current memory usage: " << memoryUsageMB << " MB";
CRASH();
}
+static void reportOOMErrorInMainThread(const char* location, bool isJsHeap)
+{
+ int memoryUsageMB = Platform::current()->actualMemoryUsageMB();
+ DVLOG(1) << "V8 " << (isJsHeap ? "javascript" : "process") << " OOM: (" << location << "). Current memory usage: " << memoryUsageMB << " MB";
+ OOM_CRASH();
+}
+
static String extractMessageForConsole(v8::Isolate* isolate, v8::Local<v8::Value> data)
{
if (V8DOMWrapper::isWrapper(isolate, data)) {
@@ -356,6 +363,7 @@ void V8Initializer::initializeMainThread()
initializeV8Common(isolate);
+ isolate->SetOOMErrorHandler(reportOOMErrorInMainThread);
isolate->SetFatalErrorHandler(reportFatalErrorInMainThread);
isolate->AddMessageListener(messageHandlerInMainThread);
isolate->SetFailedAccessCheckCallbackFunction(failedAccessCheckCallbackInMainThread);
« no previous file with comments | « skia/ext/SkMemory_new_handler.cpp ('k') | third_party/WebKit/Source/platform/heap/PageMemory.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698