Roll external/skia da95a75be..c4fec06e5 (1 commits)
https://skia.googlesource.com/skia.git/+log/da95a75be..c4fec06e5
2019-05-31 kjlubick@google.com Revert "Added AutoreleasePool for managing pool memory in testing apps."
The AutoRoll server is located here: https://autoroll-internal.skia.org/r/android-master-autoroll
Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
If the roll is causing failures, please contact the current sheriff, who should
be CC'd on the roll, and stop the roller if necessary.
Test: Presubmit checks will test this change.
Change-Id: Ibf7f988debb3d82b6a0933e0957b0452110fa6a5
Exempt-From-Owner-Approval: The autoroll bot does not require owner approval.
diff --git a/BUILD.gn b/BUILD.gn
index dff8890..32140b8 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1591,13 +1591,6 @@
libs = []
if (is_ios) {
sources += [ "tools/ios_utils.m" ]
- sources += [ "tools/ios_utils.h" ]
- sources += [ "tools/AutoreleasePool.mm" ]
- sources += [ "tools/AutoreleasePool.h" ]
- libs += [ "Foundation.framework" ]
- } else if (is_mac) {
- sources += [ "tools/AutoreleasePool.mm" ]
- sources += [ "tools/AutoreleasePool.h" ]
libs += [ "Foundation.framework" ]
} else if (is_win) {
libs += [ "DbgHelp.lib" ]
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 7e875ab..41bfdc6 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -37,7 +37,6 @@
#include "src/core/SkTraceEvent.h"
#include "src/utils/SkJSONWriter.h"
#include "src/utils/SkOSPath.h"
-#include "tools/AutoreleasePool.h"
#include "tools/CrashHandler.h"
#include "tools/ProcStats.h"
#include "tools/Stats.h"
@@ -1236,7 +1235,6 @@
int runs = 0;
BenchmarkStream benchStream;
log.beginObject("results");
- AutoreleasePool pool;
while (Benchmark* b = benchStream.next()) {
std::unique_ptr<Benchmark> bench(b);
if (CommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName())) {
@@ -1423,7 +1421,6 @@
SkDebugf("%s\n", bench->getUniqueName());
}
cleanup_run(target);
- pool.drain();
}
if (!configs.empty()) {
log.endBench();
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 00c5ca4..20d454d 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -28,7 +28,6 @@
#include "src/core/SkTaskGroup.h"
#include "src/utils/SkOSPath.h"
#include "tests/Test.h"
-#include "tools/AutoreleasePool.h"
#include "tools/HashAndEncode.h"
#include "tools/ProcStats.h"
#include "tools/Resources.h"
@@ -1022,7 +1021,6 @@
static bool gather_sinks(const GrContextOptions& grCtxOptions, bool defaultConfigs) {
SkCommandLineConfigArray configs;
ParseConfigs(FLAGS_config, &configs);
- AutoreleasePool pool;
for (int i = 0; i < configs.count(); i++) {
const SkCommandLineConfig& config = *configs[i];
Sink* sink = create_sink(grCtxOptions, &config);
@@ -1096,7 +1094,6 @@
const TaggedSink& sink;
static void Run(const Task& task) {
- AutoreleasePool pool;
SkString name = task.src->name();
SkString log;
@@ -1367,7 +1364,6 @@
} reporter;
if (!FLAGS_dryRun && !is_blacklisted("_", "tests", "_", test.name)) {
- AutoreleasePool pool;
GrContextOptions options = grCtxOptions;
test.modifyGrContextOptions(&options);
@@ -1493,7 +1489,7 @@
// A non-zero return code does not make it to Swarming
// An abort does.
#ifdef SK_BUILD_FOR_IOS
-// SK_ABORT("There were failures!");
+ SK_ABORT("There were failures!");
#endif
return 1;
}
diff --git a/src/gpu/mtl/GrMtlGpu.h b/src/gpu/mtl/GrMtlGpu.h
index 7288daf..14a47b3 100644
--- a/src/gpu/mtl/GrMtlGpu.h
+++ b/src/gpu/mtl/GrMtlGpu.h
@@ -30,6 +30,10 @@
class Compiler;
}
+// Helper macros for autorelease pools
+#define SK_BEGIN_AUTORELEASE_BLOCK @autoreleasepool {
+#define SK_END_AUTORELEASE_BLOCK }
+
class GrMtlGpu : public GrGpu {
public:
static sk_sp<GrGpu> Make(GrContext* context, const GrContextOptions& options,
diff --git a/src/gpu/mtl/GrMtlGpu.mm b/src/gpu/mtl/GrMtlGpu.mm
index 388af04..8fae4b6 100644
--- a/src/gpu/mtl/GrMtlGpu.mm
+++ b/src/gpu/mtl/GrMtlGpu.mm
@@ -1059,6 +1059,7 @@
int bpp = GrColorTypeBytesPerPixel(dstColorType);
size_t transBufferRowBytes = bpp * width;
+ SK_BEGIN_AUTORELEASE_BLOCK
bool doResolve = get_surface_sample_cnt(surface) > 1;
id<MTLTexture> mtlTexture = GrGetMTLTextureFromSurface(surface, doResolve);
if (!mtlTexture || [mtlTexture isFramebufferOnly]) {
@@ -1096,6 +1097,7 @@
const void* mappedMemory = transferBuffer.contents;
SkRectMemcpy(buffer, rowBytes, mappedMemory, transBufferRowBytes, transBufferRowBytes, height);
+ SK_END_AUTORELEASE_BLOCK
return true;
diff --git a/tools/AutoreleasePool.h b/tools/AutoreleasePool.h
deleted file mode 100644
index 2be071e..0000000
--- a/tools/AutoreleasePool.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2019 Google LLC
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkAutoreleasePool_DEFINED
-#define SkAutoreleasePool_DEFINED
-
-/*
- * Helper class for managing an autorelease pool on MacOS and iOS. On other platforms this will
- * do nothing so there's no need to #ifdef it out.
- */
-#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
-class AutoreleasePool {
-public:
- AutoreleasePool();
- ~AutoreleasePool();
-
- void drain();
-
-private:
- void* fPool;
-};
-#else
-class AutoreleasePool {
-public:
- AutoreleasePool() {}
- ~AutoreleasePool() = default;
-
- void drain() {}
-};
-#endif
-
-#endif
diff --git a/tools/AutoreleasePool.mm b/tools/AutoreleasePool.mm
deleted file mode 100644
index 6116115..0000000
--- a/tools/AutoreleasePool.mm
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 2019 Google LLC
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "include/core/SkTypes.h"
-#include "tools/AutoreleasePool.h"
-
-#import <Foundation/NSAutoreleasePool.h>
-
-AutoreleasePool::AutoreleasePool() {
- fPool = (void*)[[NSAutoreleasePool alloc] init];
-}
-
-AutoreleasePool::~AutoreleasePool() {
- [(NSAutoreleasePool*)fPool release];
- fPool = nullptr;
-}
-
-void AutoreleasePool::drain() {
- [(NSAutoreleasePool*)fPool drain];
- fPool = (void*)[[NSAutoreleasePool alloc] init];
-}
diff --git a/tools/fm/fm.cpp b/tools/fm/fm.cpp
index 3bcbbf5..4a291c0 100644
--- a/tools/fm/fm.cpp
+++ b/tools/fm/fm.cpp
@@ -17,7 +17,6 @@
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrGpu.h"
#include "src/utils/SkOSPath.h"
-#include "tools/AutoreleasePool.h"
#include "tools/CrashHandler.h"
#include "tools/HashAndEncode.h"
#include "tools/ToolUtils.h"
@@ -495,7 +494,6 @@
: SkColorSpace::MakeRGB(tf,gamut);
const SkImageInfo unsized_info = SkImageInfo::Make(0,0, ct,at,cs);
- AutoreleasePool pool;
for (auto source : sources) {
const auto start = std::chrono::steady_clock::now();
fprintf(stdout, "%50s", source.name.c_str());
@@ -584,7 +582,6 @@
fprintf(stdout, "\t%s\t%7dms\n",
md5.c_str(),
(int)std::chrono::duration_cast<std::chrono::milliseconds>(elapsed).count());
- pool.drain();
}
if (!FLAGS_writeShaders.isEmpty()) {
diff --git a/tools/gpu/mtl/MtlTestContext.mm b/tools/gpu/mtl/MtlTestContext.mm
index 0560703..e822431 100644
--- a/tools/gpu/mtl/MtlTestContext.mm
+++ b/tools/gpu/mtl/MtlTestContext.mm
@@ -16,6 +16,10 @@
#import <Metal/Metal.h>
+// Helper macros for autorelease pools
+#define SK_BEGIN_AUTORELEASE_BLOCK @autoreleasepool {
+#define SK_END_AUTORELEASE_BLOCK }
+
namespace {
#if GR_METAL_SDK_VERSION >= 200
/**
@@ -101,8 +105,10 @@
device = sharedContextImpl->device();
queue = sharedContextImpl->queue();
} else {
+ SK_BEGIN_AUTORELEASE_BLOCK
device = MTLCreateSystemDefaultDevice();
queue = [device newCommandQueue];
+ SK_END_AUTORELEASE_BLOCK
}
return new MtlTestContextImpl(device, queue);