summaryrefslogtreecommitdiffstats
path: root/skia
diff options
context:
space:
mode:
authormtklein <mtklein@chromium.org>2015-07-07 11:12:22 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-07 18:13:04 +0000
commitce512fbe98336dcda3f0046e8b942a83bbf6afff (patch)
tree566293719a1ca4544d0fd8069ef580df55538373 /skia
parent8df77b078753749b7d687119cbe115619adc6da1 (diff)
downloadchromium_src-ce512fbe98336dcda3f0046e8b942a83bbf6afff.zip
chromium_src-ce512fbe98336dcda3f0046e8b942a83bbf6afff.tar.gz
chromium_src-ce512fbe98336dcda3f0046e8b942a83bbf6afff.tar.bz2
Clean up SkMemory_new_handler.
Removes some dead code, and updates the comments. Crucially for me, this removes the only reference to SkThread.h in Chrome. BUG= Review URL: https://codereview.chromium.org/1213613015 Cr-Commit-Position: refs/heads/master@{#337643}
Diffstat (limited to 'skia')
-rw-r--r--skia/ext/SkMemory_new_handler.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/skia/ext/SkMemory_new_handler.cpp b/skia/ext/SkMemory_new_handler.cpp
index 59107f8..d4080a1 100644
--- a/skia/ext/SkMemory_new_handler.cpp
+++ b/skia/ext/SkMemory_new_handler.cpp
@@ -2,21 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <stdio.h>
#include <stdlib.h>
-#include <new>
#include "base/process/memory.h"
#include "third_party/skia/include/core/SkTypes.h"
-#include "third_party/skia/include/core/SkThread.h"
-// This implementation of sk_malloc_flags() and friends is identical to
-// SkMemory_malloc.cpp, except that it disables the CRT's new_handler during
-// malloc() and calloc() when SK_MALLOC_THROW is not set (because our normal
-// new_handler itself will crash on failure when using tcmalloc).
-
-SK_DECLARE_STATIC_MUTEX(gSkNewHandlerMutex);
+// This implementation of sk_malloc_flags() and friends is similar to
+// SkMemory_malloc.cpp, except it uses base::UncheckedMalloc and friends
+// for non-SK_MALLOC_THROW calls.
+//
+// The name of this file is historic: a previous implementation tried to
+// use std::set_new_handler() for the same effect, but it didn't actually work.
static inline void* throw_on_failure(size_t size, void* p) {
if (size > 0 && p == NULL) {