Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(612)

Unified Diff: third_party/WebKit/Source/platform/testing/ImageDecodeBench.cpp

Issue 2893023003: Add raster timing to ImageDecodeBench
Patch Set: Add includes which were accidentally removed Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/testing/ImageDecodeBench.cpp
diff --git a/third_party/WebKit/Source/platform/testing/ImageDecodeBench.cpp b/third_party/WebKit/Source/platform/testing/ImageDecodeBench.cpp
index 7d1539721d518f9862524e60695f92cc660d42d9..5b53ae52417cb786c4e4ac07e7dded312c56c79d 100644
--- a/third_party/WebKit/Source/platform/testing/ImageDecodeBench.cpp
+++ b/third_party/WebKit/Source/platform/testing/ImageDecodeBench.cpp
@@ -32,6 +32,8 @@
#include "platform/wtf/PassRefPtr.h"
#include "platform/wtf/PtrUtil.h"
#include "public/platform/Platform.h"
+#include "third_party/skia/include/core/SkCanvas.h"
+#include "third_party/skia/include/core/SkSurface.h"
#include "ui/gfx/test/icc_profiles.h"
#if defined(_WIN32)
@@ -304,6 +306,32 @@ void TimePacketedDecode(ImageDecoder* decoder,
Print2DResults(timings);
}
+void TimeRaster(ImageDecoder* decoder,
+ PassRefPtr<SharedBuffer> data,
+ size_t iterations) {
+ // Force enough parsing to later determine the image's size.
scroggo_chromium 2017/05/22 12:50:14 I find this comment confusing. Calling FrameBuffer
cblume 2017/05/22 21:33:02 Done. I think you are right that if we don't have
+ const bool all_data_received = true;
+ decoder->SetData(data.Get(), all_data_received);
+ ImageFrame* frame = decoder->FrameBufferAtIndex(0);
+
+ const auto size = decoder->Size();
+ auto surface = SkSurface::MakeRasterN32Premul(size.Width(), size.Height());
+ auto canvas = surface->getCanvas();
+
+ std::vector<double> timings(iterations);
+ for (size_t iteration = 0; iteration < iterations; ++iteration) {
scroggo_chromium 2017/05/22 12:50:14 nit: I would change "iteration" to "i". It makes i
cblume 2017/05/22 21:33:02 Done.
+ double start_time = GetCurrentTime();
+ canvas->drawBitmap(frame->Bitmap(), 0, 0, nullptr);
+ double elapsed_time = GetCurrentTime() - start_time;
+ timings[iteration] = elapsed_time;
+ }
+
+ for (double iteration_time : timings) {
+ printf("%f,\n", iteration_time);
+ }
+ printf("\n");
+}
+
} // namespace
int Main(int argc, char* argv[]) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698