summaryrefslogtreecommitdiff
path: root/chromium/third_party/skia/bench/nanobench.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/skia/bench/nanobench.cpp')
-rw-r--r--chromium/third_party/skia/bench/nanobench.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/chromium/third_party/skia/bench/nanobench.cpp b/chromium/third_party/skia/bench/nanobench.cpp
index 81e1c352e1e..4db949dc9d4 100644
--- a/chromium/third_party/skia/bench/nanobench.cpp
+++ b/chromium/third_party/skia/bench/nanobench.cpp
@@ -11,7 +11,6 @@
#include "bench/AndroidCodecBench.h"
#include "bench/Benchmark.h"
-#include "bench/BitmapRegionDecoderBench.h"
#include "bench/CodecBench.h"
#include "bench/CodecBenchPriv.h"
#include "bench/GMBench.h"
@@ -20,7 +19,6 @@
#include "bench/SKPAnimationBench.h"
#include "bench/SKPBench.h"
#include "bench/SkGlyphCacheBench.h"
-#include "include/android/SkBitmapRegionDecoder.h"
#include "include/codec/SkAndroidCodec.h"
#include "include/codec/SkCodec.h"
#include "include/core/SkCanvas.h"
@@ -52,6 +50,11 @@
#include "experimental/svg/model/SkSVGDOM.h"
#endif // SK_XML
+#ifdef SK_ENABLE_ANDROID_UTILS
+#include "bench/BitmapRegionDecoderBench.h"
+#include "client_utils/android/BitmapRegionDecoder.h"
+#endif
+
#include <cinttypes>
#include <stdlib.h>
#include <thread>
@@ -212,6 +215,13 @@ struct GPUTarget : public Target {
ContextInfo contextInfo;
std::unique_ptr<GrContextFactory> factory;
+ ~GPUTarget() override {
+ // For Vulkan we need to release all our refs to the GrContext before destroy the vulkan
+ // context which happens at the end of this destructor. Thus we need to release the surface
+ // here which holds a ref to the GrContext.
+ surface.reset();
+ }
+
void setup() override {
this->contextInfo.testContext()->makeCurrent();
// Make sure we're done with whatever came before.
@@ -586,10 +596,10 @@ static Target* is_enabled(Benchmark* bench, const Config& config) {
#pragma warning ( pop )
#endif
+#ifdef SK_ENABLE_ANDROID_UTILS
static bool valid_brd_bench(sk_sp<SkData> encoded, SkColorType colorType, uint32_t sampleSize,
uint32_t minOutputSize, int* width, int* height) {
- std::unique_ptr<SkBitmapRegionDecoder> brd(
- SkBitmapRegionDecoder::Create(encoded, SkBitmapRegionDecoder::kAndroidCodec_Strategy));
+ auto brd = android::skia::BitmapRegionDecoder::Make(encoded);
if (nullptr == brd.get()) {
// This is indicates that subset decoding is not supported for a particular image format.
return false;
@@ -607,6 +617,7 @@ static bool valid_brd_bench(sk_sp<SkData> encoded, SkColorType colorType, uint32
*height = brd->height();
return true;
}
+#endif
static void cleanup_run(Target* target) {
delete target;
@@ -967,6 +978,7 @@ public:
fCurrentSampleSize = 0;
}
+#ifdef SK_ENABLE_ANDROID_UTILS
// Run the BRDBenches
// We intend to create benchmarks that model the use cases in
// android/libraries/social/tiledimage. In this library, an image is decoded in 512x512
@@ -1050,6 +1062,7 @@ public:
}
fCurrentColorType = 0;
}
+#endif // SK_ENABLE_ANDROID_UTILS
return nullptr;
}
@@ -1079,6 +1092,7 @@ public:
}
private:
+#ifdef SK_ENABLE_ANDROID_UTILS
enum SubsetType {
kTopLeft_SubsetType = 0,
kTopRight_SubsetType = 1,
@@ -1090,6 +1104,7 @@ private:
kLast_SubsetType = kZoom_SubsetType,
kLastSingle_SubsetType = kBottomRight_SubsetType,
};
+#endif
const BenchRegistry* fBenches;
const skiagm::GMRegistry* fGMs;
@@ -1117,10 +1132,12 @@ private:
int fCurrentUseMPD = 0;
int fCurrentCodec = 0;
int fCurrentAndroidCodec = 0;
+#ifdef SK_ENABLE_ANDROID_UTILS
int fCurrentBRDImage = 0;
+ int fCurrentSubsetType = 0;
+#endif
int fCurrentColorType = 0;
int fCurrentAlphaType = 0;
- int fCurrentSubsetType = 0;
int fCurrentSampleSize = 0;
int fCurrentAnimSKP = 0;
};