aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar Kevin Lubick <kjlubick@google.com>2017-01-11 17:21:57 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-11 17:22:12 +0000
commitc456b73fef9589bbdc5eb83eaa83e53c357bb3da (patch)
treebcb8f75efaf1523bc781fa592f56d7ff86598c32 /tools
parentbc6b99d22e8d9f6543ffffdc846e40e8075046c5 (diff)
Revert "SkTypes.h : move SkAutoMalloc into SkAutoMalloc.h"
This reverts commit a5494f117086d712855e4b6289c58c92d1549bcf. Reason for revert: Broke Google3 Original change's description: > SkTypes.h : move SkAutoMalloc into SkAutoMalloc.h > > * SkAutoFree moved to SkTemplates.h (now implmented with unique_ptr). > > * SkAutoMalloc and SkAutoSMalloc moved to SkAutoMalloc.h > > * "SkAutoFree X(sk_malloc_throw(N));" --> "SkAutoMalloc X(N);" > > Change-Id: Idacd86ca09e22bf092422228599ae0d9bedded88 > Reviewed-on: https://skia-review.googlesource.com/4543 > Reviewed-by: Ben Wagner <bungeman@google.com> > Reviewed-by: Mike Reed <reed@google.com> > Commit-Queue: Hal Canary <halcanary@google.com> > TBR=halcanary@google.com,bungeman@google.com,reed@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: Ie8bd176121c3ee83c110d66c0d0ac65e09bfc9c5 Reviewed-on: https://skia-review.googlesource.com/6884 Commit-Queue: Kevin Lubick <kjlubick@google.com> Reviewed-by: Kevin Lubick <kjlubick@google.com>
Diffstat (limited to 'tools')
-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
4 files changed, 6 insertions, 8 deletions
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>