aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2018-01-04 13:52:07 -0500
committerGravatar Mike Reed <reed@google.com>2018-01-04 20:33:06 +0000
commit7edde238f741b7954a18797e88dcd04b59d79d2f (patch)
tree32a61b6027ef0ca8d7289b9c6dcbf155329a22cb
parent02a32b0fa432a720d7b41c263756a7bac53b020b (diff)
don't include SkMalloc.h from SkTypes.h
Needed chrome CLs https://chromium-review.googlesource.com/c/chromium/src/+/850741 https://chromium-review.googlesource.com/c/chromium/src/+/850920 Bug: skia: Change-Id: Ic568174a56590a65bfa284c59fd104275ee78da9 Reviewed-on: https://skia-review.googlesource.com/90823 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Reed <reed@google.com>
-rw-r--r--include/core/SkTypes.h22
-rw-r--r--include/private/SkMalloc.h2
-rw-r--r--src/core/SkMaskBlurFilter.cpp10
-rw-r--r--src/ports/SkMemory_malloc.cpp3
-rw-r--r--src/views/SkEvent.cpp19
5 files changed, 14 insertions, 42 deletions
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index 15a03d8fab..50efbaea0e 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -34,12 +34,6 @@
// IWYU pragma: end_exports
#include <string.h>
-// TODO(herb): remove after chromuim skia/ext/SkMemory_new_handler.cpp
-// has been updated to point to private/SkMalloc.h
-#include "../private/SkMalloc.h"
-
-// enable to test new device-base clipping
-//#define SK_USE_DEVICE_CLIPPING
/** \file SkTypes.h
*/
@@ -57,22 +51,6 @@
*/
SK_API extern void sk_abort_no_print(void);
-///////////////////////////////////////////////////////////////////////////////
-
-#ifdef override_GLOBAL_NEW
-#include <new>
-
-inline void* operator new(size_t size) {
- return sk_malloc_throw(size);
-}
-
-inline void operator delete(void* p) {
- sk_free(p);
-}
-#endif
-
-///////////////////////////////////////////////////////////////////////////////
-
#define SK_INIT_TO_AVOID_WARNING = 0
#ifndef SkDebugf
diff --git a/include/private/SkMalloc.h b/include/private/SkMalloc.h
index 18714e4b2f..ba14d465c1 100644
--- a/include/private/SkMalloc.h
+++ b/include/private/SkMalloc.h
@@ -11,7 +11,7 @@
#include <cstddef>
#include <cstring>
-#include "SkPreConfig.h"
+#include "SkTypes.h"
/*
memory wrappers to be implemented by the porting layer (platform)
diff --git a/src/core/SkMaskBlurFilter.cpp b/src/core/SkMaskBlurFilter.cpp
index a769c149e0..e39aa26692 100644
--- a/src/core/SkMaskBlurFilter.cpp
+++ b/src/core/SkMaskBlurFilter.cpp
@@ -5,16 +5,16 @@
* found in the LICENSE file.
*/
-#include "SkMaskBlurFilter.h"
-
-#include <cmath>
-#include <climits>
-
#include "SkArenaAlloc.h"
#include "SkGaussFilter.h"
+#include "SkMalloc.h"
+#include "SkMaskBlurFilter.h"
#include "SkNx.h"
#include "SkSafeMath.h"
+#include <cmath>
+#include <climits>
+
static const double kPi = 3.14159265358979323846264338327950288;
static constexpr double kSmallSigma = 2.0;
diff --git a/src/ports/SkMemory_malloc.cpp b/src/ports/SkMemory_malloc.cpp
index 6c21decc80..05c69d53ae 100644
--- a/src/ports/SkMemory_malloc.cpp
+++ b/src/ports/SkMemory_malloc.cpp
@@ -4,9 +4,8 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "SkMalloc.h"
-#include "SkTypes.h"
+#include "SkMalloc.h"
#include <cstdlib>
diff --git a/src/views/SkEvent.cpp b/src/views/SkEvent.cpp
index 6ead33ec7f..1bb74fb755 100644
--- a/src/views/SkEvent.cpp
+++ b/src/views/SkEvent.cpp
@@ -6,6 +6,7 @@
*/
#include "SkEvent.h"
+#include "SkMalloc.h"
void SkEvent::initialize(const char* type) {
fType = nullptr;
@@ -13,36 +14,30 @@ void SkEvent::initialize(const char* type) {
f32 = 0;
}
-SkEvent::SkEvent()
-{
+SkEvent::SkEvent() {
initialize("");
}
-SkEvent::SkEvent(const SkEvent& src)
-{
+SkEvent::SkEvent(const SkEvent& src) {
*this = src;
setType(src.fType);
}
-SkEvent::SkEvent(const char type[])
-{
+SkEvent::SkEvent(const char type[]) {
SkASSERT(type);
initialize(type);
}
-SkEvent::~SkEvent()
-{
+SkEvent::~SkEvent() {
sk_free(fType);
}
-bool SkEvent::isType(const char type[]) const
-{
+bool SkEvent::isType(const char type[]) const {
size_t typeLen = strlen(type);
return strncmp(fType, type, typeLen) == 0 && fType[typeLen] == 0;
}
-void SkEvent::setType(const char type[])
-{
+void SkEvent::setType(const char type[]) {
size_t typeLen = strlen(type);
fType = (char*) sk_malloc_throw(typeLen + 1);
memcpy(fType, type, typeLen);