aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--bench/AndroidCodecBench.h1
-rw-r--r--bench/CodecBench.h1
-rw-r--r--bench/ColorCodecBench.h1
-rw-r--r--bench/nanobench.cpp7
-rw-r--r--dm/DMSrcSink.cpp7
-rw-r--r--gm/drawatlas.cpp2
-rw-r--r--include/core/SkTypes.h216
-rw-r--r--include/private/SkTemplates.h2
-rw-r--r--src/core/SkAAClip.h1
-rw-r--r--src/core/SkAutoMalloc.h174
-rw-r--r--src/core/SkBlitter.h2
-rw-r--r--src/core/SkColorSpace_ICC.cpp3
-rw-r--r--src/core/SkDistanceFieldGen.cpp2
-rw-r--r--src/core/SkFontStream.cpp1
-rw-r--r--src/core/SkICC.cpp1
-rw-r--r--src/core/SkLinearBitmapPipeline_sample.h1
-rw-r--r--src/core/SkMaskFilter.cpp8
-rw-r--r--src/core/SkPictureData.cpp3
-rw-r--r--src/core/SkScalerContext.cpp9
-rw-r--r--src/core/SkScan_AAAPath.cpp5
-rw-r--r--src/effects/gradients/SkGradientShaderPriv.h10
-rw-r--r--src/gpu/GrDistanceFieldGenFromVector.cpp10
-rw-r--r--src/gpu/GrYUVProvider.cpp1
-rw-r--r--src/gpu/SkGr.cpp6
-rw-r--r--src/gpu/gl/GrGLGpu.cpp16
-rw-r--r--src/gpu/gl/builders/GrGLProgramBuilder.cpp1
-rw-r--r--src/gpu/gl/builders/GrGLShaderStringBuilder.cpp7
-rw-r--r--src/gpu/ops/GrAADistanceFieldPathRenderer.cpp1
-rw-r--r--src/gpu/ops/GrMSAAPathRenderer.cpp5
-rw-r--r--src/gpu/text/GrAtlasGlyphCache.cpp1
-rw-r--r--src/gpu/vk/GrVkBackendContext.cpp1
-rw-r--r--src/gpu/vk/GrVkPipelineStateDataManager.h1
-rw-r--r--src/pipe/SkPipeCanvas.cpp5
-rw-r--r--src/ports/SkFontConfigInterface_direct.cpp2
-rw-r--r--src/ports/SkFontHost_FreeType.cpp1
-rw-r--r--src/ports/SkFontHost_mac.cpp1
-rw-r--r--src/ports/SkImageEncoder_WIC.cpp4
-rw-r--r--tests/CodecTest.cpp5
-rw-r--r--tests/ColorFilterTest.cpp2
-rw-r--r--tests/FontHostTest.cpp1
-rw-r--r--tests/FrontBufferedStreamTest.cpp2
-rw-r--r--tests/MallocPixelRefTest.cpp1
-rw-r--r--tests/PaintBreakTextTest.cpp1
-rw-r--r--tests/PaintTest.cpp1
-rw-r--r--tests/PathTest.cpp6
-rw-r--r--tests/RegionTest.cpp1
-rw-r--r--tests/StreamTest.cpp1
-rw-r--r--tests/Writer32Test.cpp1
-rw-r--r--tests/YUVTest.cpp3
-rw-r--r--third_party/ktx/ktx.cpp4
-rw-r--r--tools/SkShaper_harfbuzz.cpp7
-rw-r--r--tools/debugger/SkDrawCommand.cpp3
-rw-r--r--tools/viewer/sk_app/VulkanWindowContext.cpp1
-rw-r--r--tools/viewer/sk_app/win/RasterWindowContext_win.cpp3
54 files changed, 276 insertions, 287 deletions
diff --git a/bench/AndroidCodecBench.h b/bench/AndroidCodecBench.h
index 528ecabb6b..8cdd7fec04 100644
--- a/bench/AndroidCodecBench.h
+++ b/bench/AndroidCodecBench.h
@@ -9,7 +9,6 @@
#define AndroidCodecBench_DEFINED
#include "Benchmark.h"
-#include "SkAutoMalloc.h"
#include "SkData.h"
#include "SkImageInfo.h"
#include "SkRefCnt.h"
diff --git a/bench/CodecBench.h b/bench/CodecBench.h
index dc44704ab6..5b4db24004 100644
--- a/bench/CodecBench.h
+++ b/bench/CodecBench.h
@@ -9,7 +9,6 @@
#define CodecBench_DEFINED
#include "Benchmark.h"
-#include "SkAutoMalloc.h"
#include "SkData.h"
#include "SkImageInfo.h"
#include "SkRefCnt.h"
diff --git a/bench/ColorCodecBench.h b/bench/ColorCodecBench.h
index e5048f8d7b..9159bcf9ad 100644
--- a/bench/ColorCodecBench.h
+++ b/bench/ColorCodecBench.h
@@ -9,7 +9,6 @@
#define ColorCodecBench_DEFINED
#include "Benchmark.h"
-#include "SkAutoMalloc.h"
#include "SkData.h"
#include "SkImageInfo.h"
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 34aaee8dd0..c9456db969 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -25,9 +25,8 @@
#include "Stats.h"
#include "SkAndroidCodec.h"
-#include "SkAutoMalloc.h"
-#include "SkBBoxHierarchy.h"
#include "SkBitmapRegionDecoder.h"
+#include "SkBBoxHierarchy.h"
#include "SkCanvas.h"
#include "SkCodec.h"
#include "SkCommonFlags.h"
@@ -39,13 +38,13 @@
#include "SkOSPath.h"
#include "SkPictureRecorder.h"
#include "SkPictureUtils.h"
-#include "SkSVGDOM.h"
-#include "SkScan.h"
#include "SkString.h"
#include "SkSurface.h"
+#include "SkSVGDOM.h"
#include "SkTaskGroup.h"
#include "SkThreadUtils.h"
#include "ThermalManager.h"
+#include "SkScan.h"
#include <stdlib.h>
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index cea87f7056..594a4b7182 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -8,12 +8,11 @@
#include "DMSrcSink.h"
#include "Resources.h"
#include "SkAndroidCodec.h"
-#include "SkAutoMalloc.h"
#include "SkCodec.h"
#include "SkCodecImageGenerator.h"
#include "SkColorSpace.h"
-#include "SkColorSpaceXform.h"
#include "SkColorSpace_XYZ.h"
+#include "SkColorSpaceXform.h"
#include "SkCommonFlags.h"
#include "SkData.h"
#include "SkDebugCanvas.h"
@@ -38,10 +37,10 @@
#include "SkRecorder.h"
#include "SkSVGCanvas.h"
#include "SkStream.h"
-#include "SkSwizzler.h"
#include "SkTLogic.h"
-#include <cmath>
+#include "SkSwizzler.h"
#include <functional>
+#include <cmath>
#if defined(SK_BUILD_FOR_WIN)
#include "SkAutoCoInitialize.h"
diff --git a/gm/drawatlas.cpp b/gm/drawatlas.cpp
index 2526177d6c..c098e15429 100644
--- a/gm/drawatlas.cpp
+++ b/gm/drawatlas.cpp
@@ -6,8 +6,6 @@
*/
#include "gm.h"
-
-#include "SkAutoMalloc.h"
#include "SkCanvas.h"
#include "SkRSXform.h"
#include "SkSurface.h"
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index f9e1a059fb..2cc4b9c8a9 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -509,6 +509,222 @@ private:
SkNoncopyable& operator=(const SkNoncopyable&);
};
+class SkAutoFree : SkNoncopyable {
+public:
+ SkAutoFree() : fPtr(NULL) {}
+ explicit SkAutoFree(void* ptr) : fPtr(ptr) {}
+ ~SkAutoFree() { sk_free(fPtr); }
+
+ /** Return the currently allocate buffer, or null
+ */
+ void* get() const { return fPtr; }
+
+ /** Assign a new ptr allocated with sk_malloc (or null), and return the
+ previous ptr. Note it is the caller's responsibility to sk_free the
+ returned ptr.
+ */
+ void* set(void* ptr) {
+ void* prev = fPtr;
+ fPtr = ptr;
+ return prev;
+ }
+
+ /** Transfer ownership of the current ptr to the caller, setting the
+ internal reference to null. Note the caller is reponsible for calling
+ sk_free on the returned address.
+ */
+ void* release() { return this->set(NULL); }
+
+ /** Free the current buffer, and set the internal reference to NULL. Same
+ as calling sk_free(release())
+ */
+ void reset() {
+ sk_free(fPtr);
+ fPtr = NULL;
+ }
+
+private:
+ void* fPtr;
+ // illegal
+ SkAutoFree(const SkAutoFree&);
+ SkAutoFree& operator=(const SkAutoFree&);
+};
+#define SkAutoFree(...) SK_REQUIRE_LOCAL_VAR(SkAutoFree)
+
+/**
+ * Manage an allocated block of heap memory. This object is the sole manager of
+ * the lifetime of the block, so the caller must not call sk_free() or delete
+ * on the block, unless release() was called.
+ */
+class SkAutoMalloc : SkNoncopyable {
+public:
+ explicit SkAutoMalloc(size_t size = 0) {
+ fPtr = size ? sk_malloc_throw(size) : NULL;
+ fSize = size;
+ }
+
+ ~SkAutoMalloc() {
+ sk_free(fPtr);
+ }
+
+ /**
+ * Passed to reset to specify what happens if the requested size is smaller
+ * than the current size (and the current block was dynamically allocated).
+ */
+ enum OnShrink {
+ /**
+ * If the requested size is smaller than the current size, and the
+ * current block is dynamically allocated, free the old block and
+ * malloc a new block of the smaller size.
+ */
+ kAlloc_OnShrink,
+
+ /**
+ * If the requested size is smaller than the current size, and the
+ * current block is dynamically allocated, just return the old
+ * block.
+ */
+ kReuse_OnShrink
+ };
+
+ /**
+ * Reallocates the block to a new size. The ptr may or may not change.
+ */
+ void* reset(size_t size = 0, OnShrink shrink = kAlloc_OnShrink, bool* didChangeAlloc = NULL) {
+ if (size == fSize || (kReuse_OnShrink == shrink && size < fSize)) {
+ if (didChangeAlloc) {
+ *didChangeAlloc = false;
+ }
+ return fPtr;
+ }
+
+ sk_free(fPtr);
+ fPtr = size ? sk_malloc_throw(size) : NULL;
+ fSize = size;
+ if (didChangeAlloc) {
+ *didChangeAlloc = true;
+ }
+
+ return fPtr;
+ }
+
+ /**
+ * Return the allocated block.
+ */
+ void* get() { return fPtr; }
+ const void* get() const { return fPtr; }
+
+ /** Transfer ownership of the current ptr to the caller, setting the
+ internal reference to null. Note the caller is reponsible for calling
+ sk_free on the returned address.
+ */
+ void* release() {
+ void* ptr = fPtr;
+ fPtr = NULL;
+ fSize = 0;
+ return ptr;
+ }
+
+private:
+ void* fPtr;
+ size_t fSize; // can be larger than the requested size (see kReuse)
+};
+#define SkAutoMalloc(...) SK_REQUIRE_LOCAL_VAR(SkAutoMalloc)
+
+/**
+ * Manage an allocated block of memory. If the requested size is <= kSizeRequested (or slightly
+ * more), then the allocation will come from the stack rather than the heap. This object is the
+ * sole manager of the lifetime of the block, so the caller must not call sk_free() or delete on
+ * the block.
+ */
+template <size_t kSizeRequested> class SkAutoSMalloc : SkNoncopyable {
+public:
+ /**
+ * Creates initially empty storage. get() returns a ptr, but it is to a zero-byte allocation.
+ * Must call reset(size) to return an allocated block.
+ */
+ SkAutoSMalloc() {
+ fPtr = fStorage;
+ fSize = kSize;
+ }
+
+ /**
+ * Allocate a block of the specified size. If size <= kSizeRequested (or slightly more), then
+ * the allocation will come from the stack, otherwise it will be dynamically allocated.
+ */
+ explicit SkAutoSMalloc(size_t size) {
+ fPtr = fStorage;
+ fSize = kSize;
+ this->reset(size);
+ }
+
+ /**
+ * Free the allocated block (if any). If the block was small enough to have been allocated on
+ * the stack, then this does nothing.
+ */
+ ~SkAutoSMalloc() {
+ if (fPtr != (void*)fStorage) {
+ sk_free(fPtr);
+ }
+ }
+
+ /**
+ * Return the allocated block. May return non-null even if the block is of zero size. Since
+ * this may be on the stack or dynamically allocated, the caller must not call sk_free() on it,
+ * but must rely on SkAutoSMalloc to manage it.
+ */
+ void* get() const { return fPtr; }
+
+ /**
+ * Return a new block of the requested size, freeing (as necessary) any previously allocated
+ * block. As with the constructor, if size <= kSizeRequested (or slightly more) then the return
+ * block may be allocated locally, rather than from the heap.
+ */
+ void* reset(size_t size,
+ SkAutoMalloc::OnShrink shrink = SkAutoMalloc::kAlloc_OnShrink,
+ bool* didChangeAlloc = NULL) {
+ size = (size < kSize) ? kSize : size;
+ bool alloc = size != fSize && (SkAutoMalloc::kAlloc_OnShrink == shrink || size > fSize);
+ if (didChangeAlloc) {
+ *didChangeAlloc = alloc;
+ }
+ if (alloc) {
+ if (fPtr != (void*)fStorage) {
+ sk_free(fPtr);
+ }
+
+ if (size == kSize) {
+ SkASSERT(fPtr != fStorage); // otherwise we lied when setting didChangeAlloc.
+ fPtr = fStorage;
+ } else {
+ fPtr = sk_malloc_flags(size, SK_MALLOC_THROW | SK_MALLOC_TEMP);
+ }
+
+ fSize = size;
+ }
+ SkASSERT(fSize >= size && fSize >= kSize);
+ SkASSERT((fPtr == fStorage) || fSize > kSize);
+ return fPtr;
+ }
+
+private:
+ // Align up to 32 bits.
+ static const size_t kSizeAlign4 = SkAlign4(kSizeRequested);
+#if defined(GOOGLE3)
+ // Stack frame size is limited for GOOGLE3. 4k is less than the actual max, but some functions
+ // have multiple large stack allocations.
+ static const size_t kMaxBytes = 4 * 1024;
+ static const size_t kSize = kSizeRequested > kMaxBytes ? kMaxBytes : kSizeAlign4;
+#else
+ static const size_t kSize = kSizeAlign4;
+#endif
+
+ void* fPtr;
+ size_t fSize; // can be larger than the requested size (see kReuse)
+ uint32_t fStorage[kSize >> 2];
+};
+// Can't guard the constructor because it's a template class.
+
#endif /* C++ */
#endif
diff --git a/include/private/SkTemplates.h b/include/private/SkTemplates.h
index f50af8b7f9..5c6403d509 100644
--- a/include/private/SkTemplates.h
+++ b/include/private/SkTemplates.h
@@ -462,6 +462,4 @@ private:
SkAlignedSStorage<sizeof(T)*N> fStorage;
};
-using SkAutoFree = std::unique_ptr<void, SkFunctionWrapper<void, void, sk_free>>;
-
#endif
diff --git a/src/core/SkAAClip.h b/src/core/SkAAClip.h
index c94756fd5f..7b29ef142a 100644
--- a/src/core/SkAAClip.h
+++ b/src/core/SkAAClip.h
@@ -8,7 +8,6 @@
#ifndef SkAAClip_DEFINED
#define SkAAClip_DEFINED
-#include "SkAutoMalloc.h"
#include "SkBlitter.h"
#include "SkRegion.h"
diff --git a/src/core/SkAutoMalloc.h b/src/core/SkAutoMalloc.h
deleted file mode 100644
index 7be882547d..0000000000
--- a/src/core/SkAutoMalloc.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkAutoMalloc_DEFINED
-#define SkAutoMalloc_DEFINED
-
-#include "SkTypes.h"
-
-#include <memory>
-
-/**
- * Manage an allocated block of heap memory. This object is the sole manager of
- * the lifetime of the block, so the caller must not call sk_free() or delete
- * on the block, unless release() was called.
- */
-class SkAutoMalloc : SkNoncopyable {
-public:
- explicit SkAutoMalloc(size_t size = 0)
- : fPtr(size ? sk_malloc_throw(size) : nullptr), fSize(size) {}
-
- /**
- * Passed to reset to specify what happens if the requested size is smaller
- * than the current size (and the current block was dynamically allocated).
- */
- enum OnShrink {
- /**
- * If the requested size is smaller than the current size, and the
- * current block is dynamically allocated, free the old block and
- * malloc a new block of the smaller size.
- */
- kAlloc_OnShrink,
-
- /**
- * If the requested size is smaller than the current size, and the
- * current block is dynamically allocated, just return the old
- * block.
- */
- kReuse_OnShrink
- };
-
- /**
- * Reallocates the block to a new size. The ptr may or may not change.
- */
- void* reset(size_t size = 0, OnShrink shrink = kAlloc_OnShrink) {
- if (size != fSize && (size > fSize || kReuse_OnShrink != shrink)) {
- fPtr.reset(size ? sk_malloc_throw(size) : nullptr);
- fSize = size;
- }
- return fPtr.get();
- }
-
- /**
- * Return the allocated block.
- */
- void* get() { return fPtr.get(); }
- const void* get() const { return fPtr.get(); }
-
- /** Transfer ownership of the current ptr to the caller, setting the
- internal reference to null. Note the caller is reponsible for calling
- sk_free on the returned address.
- */
- void* release() {
- fSize = 0;
- return fPtr.release();
- }
-
-private:
- struct WrapFree {
- void operator()(void* p) { sk_free(p); }
- };
- std::unique_ptr<void, WrapFree> fPtr;
- size_t fSize; // can be larger than the requested size (see kReuse)
-};
-#define SkAutoMalloc(...) SK_REQUIRE_LOCAL_VAR(SkAutoMalloc)
-
-/**
- * Manage an allocated block of memory. If the requested size is <= kSizeRequested (or slightly
- * more), then the allocation will come from the stack rather than the heap. This object is the
- * sole manager of the lifetime of the block, so the caller must not call sk_free() or delete on
- * the block.
- */
-template <size_t kSizeRequested> class SkAutoSMalloc : SkNoncopyable {
-public:
- /**
- * Creates initially empty storage. get() returns a ptr, but it is to a zero-byte allocation.
- * Must call reset(size) to return an allocated block.
- */
- SkAutoSMalloc() {
- fPtr = fStorage;
- fSize = kSize;
- }
-
- /**
- * Allocate a block of the specified size. If size <= kSizeRequested (or slightly more), then
- * the allocation will come from the stack, otherwise it will be dynamically allocated.
- */
- explicit SkAutoSMalloc(size_t size) {
- fPtr = fStorage;
- fSize = kSize;
- this->reset(size);
- }
-
- /**
- * Free the allocated block (if any). If the block was small enough to have been allocated on
- * the stack, then this does nothing.
- */
- ~SkAutoSMalloc() {
- if (fPtr != (void*)fStorage) {
- sk_free(fPtr);
- }
- }
-
- /**
- * Return the allocated block. May return non-null even if the block is of zero size. Since
- * this may be on the stack or dynamically allocated, the caller must not call sk_free() on it,
- * but must rely on SkAutoSMalloc to manage it.
- */
- void* get() const { return fPtr; }
-
- /**
- * Return a new block of the requested size, freeing (as necessary) any previously allocated
- * block. As with the constructor, if size <= kSizeRequested (or slightly more) then the return
- * block may be allocated locally, rather than from the heap.
- */
- void* reset(size_t size,
- SkAutoMalloc::OnShrink shrink = SkAutoMalloc::kAlloc_OnShrink,
- bool* didChangeAlloc = nullptr) {
- size = (size < kSize) ? kSize : size;
- bool alloc = size != fSize && (SkAutoMalloc::kAlloc_OnShrink == shrink || size > fSize);
- if (didChangeAlloc) {
- *didChangeAlloc = alloc;
- }
- if (alloc) {
- if (fPtr != (void*)fStorage) {
- sk_free(fPtr);
- }
-
- if (size == kSize) {
- SkASSERT(fPtr != fStorage); // otherwise we lied when setting didChangeAlloc.
- fPtr = fStorage;
- } else {
- fPtr = sk_malloc_flags(size, SK_MALLOC_THROW | SK_MALLOC_TEMP);
- }
-
- fSize = size;
- }
- SkASSERT(fSize >= size && fSize >= kSize);
- SkASSERT((fPtr == fStorage) || fSize > kSize);
- return fPtr;
- }
-
-private:
- // Align up to 32 bits.
- static const size_t kSizeAlign4 = SkAlign4(kSizeRequested);
-#if defined(GOOGLE3)
- // Stack frame size is limited for GOOGLE3. 4k is less than the actual max, but some functions
- // have multiple large stack allocations.
- static const size_t kMaxBytes = 4 * 1024;
- static const size_t kSize = kSizeRequested > kMaxBytes ? kMaxBytes : kSizeAlign4;
-#else
- static const size_t kSize = kSizeAlign4;
-#endif
-
- void* fPtr;
- size_t fSize; // can be larger than the requested size (see kReuse)
- uint32_t fStorage[kSize >> 2];
-};
-// Can't guard the constructor because it's a template class.
-
-#endif
diff --git a/src/core/SkBlitter.h b/src/core/SkBlitter.h
index fd6ca8c110..f03a308243 100644
--- a/src/core/SkBlitter.h
+++ b/src/core/SkBlitter.h
@@ -8,12 +8,12 @@
#ifndef SkBlitter_DEFINED
#define SkBlitter_DEFINED
-#include "SkAutoMalloc.h"
#include "SkBitmapProcShader.h"
#include "SkColor.h"
#include "SkRect.h"
#include "SkRegion.h"
#include "SkShader.h"
+#include "SkTypes.h"
class SkMatrix;
class SkPaint;
diff --git a/src/core/SkColorSpace_ICC.cpp b/src/core/SkColorSpace_ICC.cpp
index ff4b9018dd..29291a3e00 100644
--- a/src/core/SkColorSpace_ICC.cpp
+++ b/src/core/SkColorSpace_ICC.cpp
@@ -5,12 +5,11 @@
* found in the LICENSE file.
*/
-#include "SkAutoMalloc.h"
#include "SkColorSpace.h"
-#include "SkColorSpacePriv.h"
#include "SkColorSpace_A2B.h"
#include "SkColorSpace_Base.h"
#include "SkColorSpace_XYZ.h"
+#include "SkColorSpacePriv.h"
#include "SkEndian.h"
#include "SkFixed.h"
#include "SkICCPriv.h"
diff --git a/src/core/SkDistanceFieldGen.cpp b/src/core/SkDistanceFieldGen.cpp
index f227d6a30d..7e4675bbc1 100644
--- a/src/core/SkDistanceFieldGen.cpp
+++ b/src/core/SkDistanceFieldGen.cpp
@@ -5,10 +5,8 @@
* found in the LICENSE file.
*/
-#include "SkAutoMalloc.h"
#include "SkDistanceFieldGen.h"
#include "SkPoint.h"
-#include "SkTemplates.h"
struct DFData {
float fAlpha; // alpha value of source texel
diff --git a/src/core/SkFontStream.cpp b/src/core/SkFontStream.cpp
index e9f23f9f24..b2ffe8deba 100644
--- a/src/core/SkFontStream.cpp
+++ b/src/core/SkFontStream.cpp
@@ -5,7 +5,6 @@
* found in the LICENSE file.
*/
-#include "SkAutoMalloc.h"
#include "SkEndian.h"
#include "SkFontStream.h"
#include "SkStream.h"
diff --git a/src/core/SkICC.cpp b/src/core/SkICC.cpp
index 6b09f29dae..b47cc71574 100644
--- a/src/core/SkICC.cpp
+++ b/src/core/SkICC.cpp
@@ -5,7 +5,6 @@
* found in the LICENSE file.
*/
-#include "SkAutoMalloc.h"
#include "SkColorSpace_Base.h"
#include "SkColorSpace_XYZ.h"
#include "SkColorSpacePriv.h"
diff --git a/src/core/SkLinearBitmapPipeline_sample.h b/src/core/SkLinearBitmapPipeline_sample.h
index 0bfe8f26ae..8e53136fea 100644
--- a/src/core/SkLinearBitmapPipeline_sample.h
+++ b/src/core/SkLinearBitmapPipeline_sample.h
@@ -10,7 +10,6 @@
#include <tuple>
-#include "SkAutoMalloc.h"
#include "SkColor.h"
#include "SkColorPriv.h"
#include "SkFixed.h"
diff --git a/src/core/SkMaskFilter.cpp b/src/core/SkMaskFilter.cpp
index 8ad13aab97..85ee38d6dd 100644
--- a/src/core/SkMaskFilter.cpp
+++ b/src/core/SkMaskFilter.cpp
@@ -5,15 +5,15 @@
* found in the LICENSE file.
*/
-#include "SkMaskFilter.h"
-#include "SkAutoMalloc.h"
+#include "SkMaskFilter.h"
#include "SkBlitter.h"
-#include "SkCachedData.h"
#include "SkDraw.h"
+#include "SkCachedData.h"
#include "SkPath.h"
-#include "SkRRect.h"
#include "SkRasterClip.h"
+#include "SkRRect.h"
+#include "SkTypes.h"
#if SK_SUPPORT_GPU
#include "GrTexture.h"
diff --git a/src/core/SkPictureData.cpp b/src/core/SkPictureData.cpp
index 9780b7d104..1aff1e46b9 100644
--- a/src/core/SkPictureData.cpp
+++ b/src/core/SkPictureData.cpp
@@ -4,10 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
#include <new>
-
-#include "SkAutoMalloc.h"
#include "SkImageGenerator.h"
#include "SkPictureData.h"
#include "SkPictureRecord.h"
diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp
index 4835b5297d..c06222d4d8 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -5,9 +5,8 @@
* found in the LICENSE file.
*/
-#include "SkScalerContext.h"
-#include "SkAutoMalloc.h"
+#include "SkScalerContext.h"
#include "SkAutoPixmapStorage.h"
#include "SkColorPriv.h"
#include "SkDescriptor.h"
@@ -17,13 +16,13 @@
#include "SkMaskFilter.h"
#include "SkMaskGamma.h"
#include "SkMatrix22.h"
+#include "SkReadBuffer.h"
+#include "SkWriteBuffer.h"
#include "SkPathEffect.h"
-#include "SkRasterClip.h"
#include "SkRasterizer.h"
-#include "SkReadBuffer.h"
+#include "SkRasterClip.h"
#include "SkStroke.h"
#include "SkStrokeRec.h"
-#include "SkWriteBuffer.h"
#define ComputeBWRowBytes(width) (((unsigned)(width) + 7) >> 3)
diff --git a/src/core/SkScan_AAAPath.cpp b/src/core/SkScan_AAAPath.cpp
index 8c0a748bdf..f96e7b9bb8 100644
--- a/src/core/SkScan_AAAPath.cpp
+++ b/src/core/SkScan_AAAPath.cpp
@@ -5,11 +5,10 @@
* found in the LICENSE file.
*/
-#include "SkAnalyticEdge.h"
#include "SkAntiRun.h"
-#include "SkAutoMalloc.h"
#include "SkBlitter.h"
#include "SkEdge.h"
+#include "SkAnalyticEdge.h"
#include "SkEdgeBuilder.h"
#include "SkGeometry.h"
#include "SkPath.h"
@@ -18,8 +17,8 @@
#include "SkRegion.h"
#include "SkScan.h"
#include "SkScanPriv.h"
-#include "SkTSort.h"
#include "SkTemplates.h"
+#include "SkTSort.h"
#include "SkUtils.h"
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h
index 48ccbd50d0..4b7bbb0a0a 100644
--- a/src/effects/gradients/SkGradientShaderPriv.h
+++ b/src/effects/gradients/SkGradientShaderPriv.h
@@ -10,17 +10,15 @@
#include "SkGradientBitmapCache.h"
#include "SkGradientShader.h"
-
-#include "SkAutoMalloc.h"
#include "SkClampRange.h"
#include "SkColorPriv.h"
#include "SkColorSpace.h"
-#include "SkMallocPixelRef.h"
-#include "SkOnce.h"
#include "SkReadBuffer.h"
-#include "SkShader.h"
-#include "SkUtils.h"
#include "SkWriteBuffer.h"
+#include "SkMallocPixelRef.h"
+#include "SkUtils.h"
+#include "SkShader.h"
+#include "SkOnce.h"
#if SK_SUPPORT_GPU
#define GR_GL_USE_ACCURATE_HARD_STOP_GRADIENTS 1
diff --git a/src/gpu/GrDistanceFieldGenFromVector.cpp b/src/gpu/GrDistanceFieldGenFromVector.cpp
index 4a509e67af..8179500660 100644
--- a/src/gpu/GrDistanceFieldGenFromVector.cpp
+++ b/src/gpu/GrDistanceFieldGenFromVector.cpp
@@ -7,14 +7,12 @@
#include "SkDistanceFieldGen.h"
#include "GrDistanceFieldGenFromVector.h"
-
-#include "GrConfig.h"
-#include "GrPathUtils.h"
-#include "SkAutoMalloc.h"
-#include "SkGeometry.h"
#include "SkMatrix.h"
-#include "SkPathOps.h"
#include "SkPoint.h"
+#include "SkGeometry.h"
+#include "SkPathOps.h"
+#include "GrPathUtils.h"
+#include "GrConfig.h"
/**
* If a scanline (a row of texel) cross from the kRight_SegSide
diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp
index 9f88c72d22..6fbad18841 100644
--- a/src/gpu/GrYUVProvider.cpp
+++ b/src/gpu/GrYUVProvider.cpp
@@ -11,7 +11,6 @@
#include "effects/GrGammaEffect.h"
#include "effects/GrYUVEffect.h"
-#include "SkAutoMalloc.h"
#include "SkCachedData.h"
#include "SkRefCnt.h"
#include "SkResourceCache.h"
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index c1a4160b83..9d6072c551 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
+
#include "SkGr.h"
#include "SkGrPriv.h"
@@ -18,17 +19,16 @@
#include "GrXferProcessor.h"
#include "GrYUVProvider.h"
-#include "SkAutoMalloc.h"
#include "SkBlendModePriv.h"
-#include "SkCanvas.h"
#include "SkColorFilter.h"
#include "SkConfig8888.h"
+#include "SkCanvas.h"
#include "SkData.h"
#include "SkMaskFilter.h"
#include "SkMessageBus.h"
#include "SkMipMap.h"
-#include "SkPM4fPriv.h"
#include "SkPixelRef.h"
+#include "SkPM4fPriv.h"
#include "SkResourceCache.h"
#include "SkTemplates.h"
#include "SkYUVPlanesCache.h"
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 95a01ab695..74e52583dd 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -6,33 +6,31 @@
*/
#include "GrGLGpu.h"
-
-#include "../private/GrGLSL.h"
-#include "GrFixedClip.h"
#include "GrGLBuffer.h"
#include "GrGLGpuCommandBuffer.h"
#include "GrGLStencilAttachment.h"
#include "GrGLTextureRenderTarget.h"
+#include "GrFixedClip.h"
#include "GrGpuResourcePriv.h"
#include "GrMesh.h"
-#include "GrPLSGeometryProcessor.h"
#include "GrPipeline.h"
+#include "GrPLSGeometryProcessor.h"
#include "GrRenderTargetPriv.h"
#include "GrShaderCaps.h"
#include "GrSurfacePriv.h"
#include "GrTexturePriv.h"
#include "GrTypes.h"
-#include "SkAutoMalloc.h"
+#include "builders/GrGLShaderStringBuilder.h"
+#include "glsl/GrGLSLPLSPathRendering.h"
+#include "instanced/GLInstancedRendering.h"
#include "SkMakeUnique.h"
#include "SkMipMap.h"
#include "SkPixmap.h"
-#include "SkSLCompiler.h"
#include "SkStrokeRec.h"
+#include "SkSLCompiler.h"
#include "SkTemplates.h"
#include "SkTypes.h"
-#include "builders/GrGLShaderStringBuilder.h"
-#include "glsl/GrGLSLPLSPathRendering.h"
-#include "instanced/GLInstancedRendering.h"
+#include "../private/GrGLSL.h"
#define GL_CALL(X) GR_GL_CALL(this->glInterface(), X)
#define GL_CALL_RET(RET, X) GR_GL_CALL_RET(this->glInterface(), RET, X)
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index c3e81fb358..045593ff42 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -14,7 +14,6 @@
#include "GrShaderCaps.h"
#include "GrSwizzle.h"
#include "GrTexture.h"
-#include "SkAutoMalloc.h"
#include "SkTraceEvent.h"
#include "gl/GrGLGpu.h"
#include "gl/GrGLProgram.h"
diff --git a/src/gpu/gl/builders/GrGLShaderStringBuilder.cpp b/src/gpu/gl/builders/GrGLShaderStringBuilder.cpp
index 6c719fe305..df44edd07e 100644
--- a/src/gpu/gl/builders/GrGLShaderStringBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLShaderStringBuilder.cpp
@@ -6,12 +6,11 @@
*/
#include "GrGLShaderStringBuilder.h"
-#include "SkAutoMalloc.h"
-#include "SkSLCompiler.h"
-#include "SkSLGLSLCodeGenerator.h"
-#include "SkTraceEvent.h"
#include "gl/GrGLGpu.h"
#include "gl/GrGLSLPrettyPrint.h"
+#include "SkTraceEvent.h"
+#include "SkSLCompiler.h"
+#include "SkSLGLSLCodeGenerator.h"
#include "ir/SkSLProgram.h"
#define GL_CALL(X) GR_GL_CALL(gpu->glInterface(), X)
diff --git a/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp b/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp
index 616b69f276..c9b30f5154 100644
--- a/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp
@@ -21,7 +21,6 @@
#include "ops/GrMeshDrawOp.h"
#include "SkPathOps.h"
-#include "SkAutoMalloc.h"
#include "SkDistanceFieldGen.h"
#include "GrDistanceFieldGenFromVector.h"
diff --git a/src/gpu/ops/GrMSAAPathRenderer.cpp b/src/gpu/ops/GrMSAAPathRenderer.cpp
index 53e4690eff..cc6781cac4 100644
--- a/src/gpu/ops/GrMSAAPathRenderer.cpp
+++ b/src/gpu/ops/GrMSAAPathRenderer.cpp
@@ -16,7 +16,6 @@
#include "GrPathStencilSettings.h"
#include "GrPathUtils.h"
#include "GrPipelineBuilder.h"
-#include "SkAutoMalloc.h"
#include "SkGeometry.h"
#include "SkTraceEvent.h"
#include "gl/GrGLVaryingHandler.h"
@@ -347,7 +346,7 @@ private:
MSAAQuadVertices quads;
size_t quadVertexStride = sizeof(MSAAQuadVertices::Vertex);
- SkAutoMalloc quadVertexPtr(fMaxQuadVertices * quadVertexStride);
+ SkAutoFree quadVertexPtr(sk_malloc_throw(fMaxQuadVertices * quadVertexStride));
quads.vertices = (MSAAQuadVertices::Vertex*) quadVertexPtr.get();
quads.nextVertex = quads.vertices;
SkDEBUGCODE(quads.verticesEnd = quads.vertices + fMaxQuadVertices;)
@@ -370,7 +369,7 @@ private:
SkAutoFree quadIndexPtr;
if (fIsIndexed) {
quads.indices = (uint16_t*)sk_malloc_throw(3 * fMaxQuadVertices * sizeof(uint16_t));
- quadIndexPtr.reset(quads.indices);
+ quadIndexPtr.set(quads.indices);
quads.nextIndex = quads.indices;
} else {
quads.indices = nullptr;
diff --git a/src/gpu/text/GrAtlasGlyphCache.cpp b/src/gpu/text/GrAtlasGlyphCache.cpp
index e51f6cc381..5d85f4919d 100644
--- a/src/gpu/text/GrAtlasGlyphCache.cpp
+++ b/src/gpu/text/GrAtlasGlyphCache.cpp
@@ -11,7 +11,6 @@
#include "GrRectanizer.h"
#include "GrResourceProvider.h"
#include "GrSurfacePriv.h"
-#include "SkAutoMalloc.h"
#include "SkString.h"
#include "SkDistanceFieldGen.h"
diff --git a/src/gpu/vk/GrVkBackendContext.cpp b/src/gpu/vk/GrVkBackendContext.cpp
index 5a9de04d39..93ae01ff6f 100644
--- a/src/gpu/vk/GrVkBackendContext.cpp
+++ b/src/gpu/vk/GrVkBackendContext.cpp
@@ -5,7 +5,6 @@
* found in the LICENSE file.
*/
-#include "SkAutoMalloc.h"
#include "vk/GrVkBackendContext.h"
#include "vk/GrVkExtensions.h"
#include "vk/GrVkInterface.h"
diff --git a/src/gpu/vk/GrVkPipelineStateDataManager.h b/src/gpu/vk/GrVkPipelineStateDataManager.h
index 4a061a66f9..312c6c659d 100644
--- a/src/gpu/vk/GrVkPipelineStateDataManager.h
+++ b/src/gpu/vk/GrVkPipelineStateDataManager.h
@@ -10,7 +10,6 @@
#include "glsl/GrGLSLProgramDataManager.h"
-#include "SkAutoMalloc.h"
#include "vk/GrVkUniformHandler.h"
class GrVkGpu;
diff --git a/src/pipe/SkPipeCanvas.cpp b/src/pipe/SkPipeCanvas.cpp
index e707f0db19..33b58a4165 100644
--- a/src/pipe/SkPipeCanvas.cpp
+++ b/src/pipe/SkPipeCanvas.cpp
@@ -5,16 +5,15 @@
* found in the LICENSE file.
*/
-#include "SkAutoMalloc.h"
+#include "SkPathEffect.h"
#include "SkColorFilter.h"
#include "SkDrawLooper.h"
#include "SkImageFilter.h"
#include "SkMaskFilter.h"
-#include "SkPathEffect.h"
#include "SkPipeCanvas.h"
#include "SkPipeFormat.h"
-#include "SkRSXform.h"
#include "SkRasterizer.h"
+#include "SkRSXform.h"
#include "SkShader.h"
#include "SkStream.h"
#include "SkTextBlob.h"
diff --git a/src/ports/SkFontConfigInterface_direct.cpp b/src/ports/SkFontConfigInterface_direct.cpp
index c1a73e626c..df68fae0a8 100644
--- a/src/ports/SkFontConfigInterface_direct.cpp
+++ b/src/ports/SkFontConfigInterface_direct.cpp
@@ -7,7 +7,6 @@
/* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */
-#include "SkAutoMalloc.h"
#include "SkBuffer.h"
#include "SkDataTable.h"
#include "SkFixed.h"
@@ -20,6 +19,7 @@
#include "SkTDArray.h"
#include "SkTemplates.h"
#include "SkTypeface.h"
+#include "SkTypes.h"
#include <fontconfig/fontconfig.h>
#include <unistd.h>
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index 47790f3644..15bc14d213 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -25,6 +25,7 @@
#include "SkStream.h"
#include "SkString.h"
#include "SkTemplates.h"
+#include "SkTypes.h"
#include <memory>
#if defined(SK_CAN_USE_DLOPEN)
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index ce4895419f..274c9253a9 100644
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -20,7 +20,6 @@
#endif
#include "SkAdvancedTypefaceMetrics.h"
-#include "SkAutoMalloc.h"
#include "SkCGUtils.h"
#include "SkColorPriv.h"
#include "SkDescriptor.h"
diff --git a/src/ports/SkImageEncoder_WIC.cpp b/src/ports/SkImageEncoder_WIC.cpp
index 6bc8b5473e..52f4599433 100644
--- a/src/ports/SkImageEncoder_WIC.cpp
+++ b/src/ports/SkImageEncoder_WIC.cpp
@@ -28,16 +28,14 @@
#undef INT64_MAX
#undef UINT64_MAX
+#include <wincodec.h>
#include "SkAutoCoInitialize.h"
-#include "SkAutoMalloc.h"
#include "SkBitmap.h"
#include "SkImageEncoderPriv.h"
#include "SkIStream.h"
-#include "SkImageEncoder.h"
#include "SkStream.h"
#include "SkTScopedComPtr.h"
#include "SkUnPreMultiply.h"
-#include <wincodec.h>
//All Windows SDKs back to XPSP2 export the CLSID_WICImagingFactory symbol.
//In the Windows8 SDK the CLSID_WICImagingFactory symbol is still exported
diff --git a/tests/CodecTest.cpp b/tests/CodecTest.cpp
index 0f6d54c8d7..01e9cc4d45 100644
--- a/tests/CodecTest.cpp
+++ b/tests/CodecTest.cpp
@@ -8,19 +8,18 @@
#include "FakeStreams.h"
#include "Resources.h"
#include "SkAndroidCodec.h"
-#include "SkAutoMalloc.h"
#include "SkBitmap.h"
#include "SkCodec.h"
#include "SkCodecImageGenerator.h"
#include "SkColorSpace_XYZ.h"
#include "SkData.h"
-#include "SkFrontBufferedStream.h"
#include "SkImageEncoder.h"
+#include "SkFrontBufferedStream.h"
#include "SkMD5.h"
-#include "SkPngChunkReader.h"
#include "SkRandom.h"
#include "SkStream.h"
#include "SkStreamPriv.h"
+#include "SkPngChunkReader.h"
#include "Test.h"
#include "png.h"
diff --git a/tests/ColorFilterTest.cpp b/tests/ColorFilterTest.cpp
index b6456a6414..ad2dd0fc35 100644
--- a/tests/ColorFilterTest.cpp
+++ b/tests/ColorFilterTest.cpp
@@ -5,12 +5,10 @@
* found in the LICENSE file.
*/
-#include "SkAutoMalloc.h"
#include "SkColor.h"
#include "SkColorFilter.h"
#include "SkColorPriv.h"
#include "SkLumaColorFilter.h"
-#include "SkRandom.h"
#include "SkReadBuffer.h"
#include "SkWriteBuffer.h"
#include "SkRandom.h"
diff --git a/tests/FontHostTest.cpp b/tests/FontHostTest.cpp
index 3d54c57fe7..55c524424f 100644
--- a/tests/FontHostTest.cpp
+++ b/tests/FontHostTest.cpp
@@ -6,7 +6,6 @@
*/
#include "Resources.h"
-#include "SkAutoMalloc.h"
#include "SkEndian.h"
#include "SkFontStream.h"
#include "SkOSFile.h"
diff --git a/tests/FrontBufferedStreamTest.cpp b/tests/FrontBufferedStreamTest.cpp
index 69ff488358..a3862741e3 100644
--- a/tests/FrontBufferedStreamTest.cpp
+++ b/tests/FrontBufferedStreamTest.cpp
@@ -5,12 +5,12 @@
* found in the LICENSE file.
*/
-#include "SkAutoMalloc.h"
#include "SkBitmap.h"
#include "SkCodec.h"
#include "SkFrontBufferedStream.h"
#include "SkRefCnt.h"
#include "SkStream.h"
+#include "SkTypes.h"
#include "Test.h"
static void test_read(skiatest::Reporter* reporter, SkStream* bufferedStream,
diff --git a/tests/MallocPixelRefTest.cpp b/tests/MallocPixelRefTest.cpp
index 7e2bece7be..09e1b934e9 100644
--- a/tests/MallocPixelRefTest.cpp
+++ b/tests/MallocPixelRefTest.cpp
@@ -5,7 +5,6 @@
* found in the LICENSE file.
*/
-#include "SkAutoMalloc.h"
#include "SkData.h"
#include "SkMallocPixelRef.h"
#include "Test.h"
diff --git a/tests/PaintBreakTextTest.cpp b/tests/PaintBreakTextTest.cpp
index b716c60c99..474bbf686a 100644
--- a/tests/PaintBreakTextTest.cpp
+++ b/tests/PaintBreakTextTest.cpp
@@ -5,7 +5,6 @@
* found in the LICENSE file.
*/
-#include "SkAutoMalloc.h"
#include "SkPaint.h"
#include "Test.h"
diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp
index 55a82a73e4..76bfb02923 100644
--- a/tests/PaintTest.cpp
+++ b/tests/PaintTest.cpp
@@ -5,7 +5,6 @@
* found in the LICENSE file.
*/
-#include "SkAutoMalloc.h"
#include "SkBlurMask.h"
#include "SkBlurMaskFilter.h"
#include "SkLayerDrawLooper.h"
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 0ace812ef1..2059c36db3 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -5,14 +5,14 @@
* found in the LICENSE file.
*/
-#include "SkAutoMalloc.h"
+#include <cmath>
#include "SkCanvas.h"
#include "SkGeometry.h"
#include "SkPaint.h"
#include "SkParse.h"
#include "SkParsePath.h"
-#include "SkPathEffect.h"
#include "SkPathPriv.h"
+#include "SkPathEffect.h"
#include "SkRRect.h"
#include "SkRandom.h"
#include "SkReader32.h"
@@ -20,9 +20,9 @@
#include "SkStream.h"
#include "SkStrokeRec.h"
#include "SkSurface.h"
+#include "SkTypes.h"
#include "SkWriter32.h"
#include "Test.h"
-#include <cmath>
static void set_radii(SkVector radii[4], int index, float rad) {
sk_bzero(radii, sizeof(SkVector) * 4);
diff --git a/tests/RegionTest.cpp b/tests/RegionTest.cpp
index 172082248a..4a96056419 100644
--- a/tests/RegionTest.cpp
+++ b/tests/RegionTest.cpp
@@ -5,7 +5,6 @@
* found in the LICENSE file.
*/
-#include "SkAutoMalloc.h"
#include "SkPath.h"
#include "SkRandom.h"
#include "SkRegion.h"
diff --git a/tests/StreamTest.cpp b/tests/StreamTest.cpp
index fba09c989a..ff23ca2341 100644
--- a/tests/StreamTest.cpp
+++ b/tests/StreamTest.cpp
@@ -6,7 +6,6 @@
*/
#include "Resources.h"
-#include "SkAutoMalloc.h"
#include "SkData.h"
#include "SkFrontBufferedStream.h"
#include "SkOSFile.h"
diff --git a/tests/Writer32Test.cpp b/tests/Writer32Test.cpp
index 6cb79f8270..3eab94cd2d 100644
--- a/tests/Writer32Test.cpp
+++ b/tests/Writer32Test.cpp
@@ -5,7 +5,6 @@
* found in the LICENSE file.
*/
-#include "SkAutoMalloc.h"
#include "SkRandom.h"
#include "SkReader32.h"
#include "SkWriter32.h"
diff --git a/tests/YUVTest.cpp b/tests/YUVTest.cpp
index 0c31c0929a..913997b3c3 100644
--- a/tests/YUVTest.cpp
+++ b/tests/YUVTest.cpp
@@ -5,9 +5,8 @@
* found in the LICENSE file.
*/
-#include "Resources.h"
-#include "SkAutoMalloc.h"
#include "SkCodec.h"
+#include "Resources.h"
#include "SkStream.h"
#include "SkTemplates.h"
#include "SkYUVSizeInfo.h"
diff --git a/third_party/ktx/ktx.cpp b/third_party/ktx/ktx.cpp
index a65c6f220b..ba3ba1fc27 100644
--- a/third_party/ktx/ktx.cpp
+++ b/third_party/ktx/ktx.cpp
@@ -6,11 +6,9 @@
*/
#include "ktx.h"
-
-#include "SkAutoMalloc.h"
#include "SkBitmap.h"
-#include "SkEndian.h"
#include "SkStream.h"
+#include "SkEndian.h"
#include "gl/GrGLDefines.h"
#include "GrConfig.h"
diff --git a/tools/SkShaper_harfbuzz.cpp b/tools/SkShaper_harfbuzz.cpp
index 9c7d69e92d..2c4d21180d 100644
--- a/tools/SkShaper_harfbuzz.cpp
+++ b/tools/SkShaper_harfbuzz.cpp
@@ -28,9 +28,10 @@ std::unique_ptr<hb_blob_t, HBFBlobDel> stream_to_blob(std::unique_ptr<SkStreamAs
[](void* p) { delete (SkStreamAsset*)p; }));
} else {
// SkDebugf("Extra SkStreamAsset copy\n");
- void* ptr = size ? sk_malloc_throw(size) : nullptr;
- asset->read(ptr, size);
- blob.reset(hb_blob_create((char*)ptr, SkToUInt(size),
+ SkAutoMalloc autoMalloc(size);
+ asset->read(autoMalloc.get(), size);
+ void* ptr = autoMalloc.get();
+ blob.reset(hb_blob_create((char*)autoMalloc.release(), SkToUInt(size),
HB_MEMORY_MODE_READONLY, ptr, sk_free));
}
SkASSERT(blob);
diff --git a/tools/debugger/SkDrawCommand.cpp b/tools/debugger/SkDrawCommand.cpp
index 6dea988831..4eaf2ea84a 100644
--- a/tools/debugger/SkDrawCommand.cpp
+++ b/tools/debugger/SkDrawCommand.cpp
@@ -9,7 +9,6 @@
#include "png.h"
-#include "SkAutoMalloc.h"
#include "SkBlurMaskFilter.h"
#include "SkColorFilter.h"
#include "SkDashPathEffect.h"
@@ -705,7 +704,7 @@ void SkDrawCommand::WritePNG(const uint8_t* rgba, unsigned width, unsigned heigh
bool SkDrawCommand::flatten(const SkImage& image, Json::Value* target,
UrlDataManager& urlDataManager) {
size_t rowBytes = 4 * image.width();
- SkAutoMalloc buffer(rowBytes * image.height());
+ SkAutoFree buffer(sk_malloc_throw(rowBytes * image.height()));
SkImageInfo dstInfo = SkImageInfo::Make(image.width(), image.height(),
kN32_SkColorType, kPremul_SkAlphaType);
if (!image.readPixels(dstInfo, buffer.get(), rowBytes, 0, 0)) {
diff --git a/tools/viewer/sk_app/VulkanWindowContext.cpp b/tools/viewer/sk_app/VulkanWindowContext.cpp
index 4802e214b4..c8335d28b4 100644
--- a/tools/viewer/sk_app/VulkanWindowContext.cpp
+++ b/tools/viewer/sk_app/VulkanWindowContext.cpp
@@ -8,7 +8,6 @@
#include "GrContext.h"
#include "GrRenderTarget.h"
-#include "SkAutoMalloc.h"
#include "SkSurface.h"
#include "VulkanWindowContext.h"
diff --git a/tools/viewer/sk_app/win/RasterWindowContext_win.cpp b/tools/viewer/sk_app/win/RasterWindowContext_win.cpp
index 96fe8f22a9..ca738db288 100644
--- a/tools/viewer/sk_app/win/RasterWindowContext_win.cpp
+++ b/tools/viewer/sk_app/win/RasterWindowContext_win.cpp
@@ -5,10 +5,9 @@
* found in the LICENSE file.
*/
+#include "WindowContextFactory_win.h"
#include "../RasterWindowContext.h"
-#include "SkAutoMalloc.h"
#include "SkSurface.h"
-#include "WindowContextFactory_win.h"
#include <Windows.h>