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

Unified Diff: skia/ext/SkMemory_new_handler.cpp

Issue 836733006: Fix EnableTerminationOnOutOfMemory for malloc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: skia piece Created 5 years, 11 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
« content/app/startup_helper_win.cc ('K') | « content/app/startup_helper_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/SkMemory_new_handler.cpp
diff --git a/skia/ext/SkMemory_new_handler.cpp b/skia/ext/SkMemory_new_handler.cpp
index 015521f313ac83b2797689d048557b495e3f9049..edf0f968bfed975ca431384ef5cbd1bea6026c35 100644
--- a/skia/ext/SkMemory_new_handler.cpp
+++ b/skia/ext/SkMemory_new_handler.cpp
@@ -60,13 +60,7 @@ static void* sk_malloc_nothrow(size_t size) {
ignore_result(base::UncheckedMalloc(size, &result));
return result;
#else
- // This is not really thread safe. It only won't collide with itself, but we're totally
cpu_(ooo_6.6-7.5) 2015/01/10 05:37:28 this code is wrong. libraries shall not to touch g
grt (UTC plus 2) 2015/01/12 14:29:14 Should this use base::UncheckedMalloc on Win as we
- // unprotected from races with other code that calls set_new_handler.
- SkAutoMutexAcquire lock(gSkNewHandlerMutex);
- std::new_handler old_handler = std::set_new_handler(NULL);
- void* p = malloc(size);
- std::set_new_handler(old_handler);
- return p;
+ return malloc(size);
#endif
}
@@ -91,10 +85,6 @@ void* sk_calloc(size_t size) {
ignore_result(base::UncheckedCalloc(size, 1, &result));
return result;
#else
- SkAutoMutexAcquire lock(gSkNewHandlerMutex);
- std::new_handler old_handler = std::set_new_handler(NULL);
- void* p = calloc(size, 1);
- std::set_new_handler(old_handler);
- return p;
+ return calloc(size, 1);
#endif
}
« content/app/startup_helper_win.cc ('K') | « content/app/startup_helper_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698