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

Unified Diff: third_party/WebKit/Source/web/ImageDecodeBench.cpp

Issue 1879133002: Make ImageDecodeBench build once again (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove TestingPlatformSupport changes, no longer needed Created 4 years, 8 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/web/ImageDecodeBench.cpp
diff --git a/third_party/WebKit/Source/web/ImageDecodeBench.cpp b/third_party/WebKit/Source/web/ImageDecodeBench.cpp
index b0738bb999a298d8e4892256a5ae295eed61b5be..8290091512f29f39f84f30430e94d1a77f58893e 100644
--- a/third_party/WebKit/Source/web/ImageDecodeBench.cpp
+++ b/third_party/WebKit/Source/web/ImageDecodeBench.cpp
@@ -17,18 +17,15 @@
// using the image corpii used to assess Blink image decode performance. Refer
// to http://crbug.com/398235#c103 and http://crbug.com/258324#c5
+#include "base/command_line.h"
#include "platform/SharedBuffer.h"
#include "platform/image-decoders/ImageDecoder.h"
-#include "platform/testing/TestingPlatformSupport.h"
#include "public/platform/Platform.h"
#include "public/web/WebKit.h"
#include "wtf/OwnPtr.h"
#include "wtf/PassRefPtr.h"
#if defined(_WIN32)
-#if defined(WIN32_LEAN_AND_MEAN)
-#error Fix: WIN32_LEAN_AND_MEAN disables timeBeginPeriod/TimeEndPeriod.
-#endif
Noel Gordon 2016/05/02 12:34:55 Yeap, that looks good.
#include <mmsystem.h>
#include <sys/stat.h>
#include <time.h>
@@ -280,10 +277,10 @@ bool decodeImageData(SharedBuffer* data, bool colorCorrection, size_t packetSize
}
RefPtr<SharedBuffer> packetData = SharedBuffer::create();
- unsigned position = 0;
+ size_t position = 0;
while (true) {
const char* packet;
- unsigned length = data->getSomeData(packet, position);
+ size_t length = data->getSomeData(packet, position);
length = std::min(static_cast<size_t>(length), packetSize);
Noel Gordon 2016/05/02 12:34:55 nit: static_cast<size_t>(length) -> length
packetData->append(packet, length);
@@ -307,6 +304,7 @@ bool decodeImageData(SharedBuffer* data, bool colorCorrection, size_t packetSize
int main(int argc, char* argv[])
{
+ base::CommandLine::Init(argc, argv);
Noel Gordon 2016/05/02 12:34:55 As you noted, this is the thing we need to fix (du
char* name = argv[0];
// If the platform supports color correction, allow it to be controlled.
@@ -355,7 +353,7 @@ int main(int argc, char* argv[])
// Create a web platform without V8.
- class WebPlatform : public TestingPlatformSupport {
+ class WebPlatform : public blink::Platform {
public:
void screenColorProfile(WebVector<char>* profile) override
{
@@ -367,10 +365,6 @@ int main(int argc, char* argv[])
// Set image decoding Platform options.
-#if USE(QCMSLIB)
- ImageDecoder::qcmsOutputDeviceProfile(); // Initialize screen colorProfile.
-#endif
-
// Read entire file content to data.
RefPtr<SharedBuffer> data = readFile(argv[1]);
@@ -382,6 +376,12 @@ int main(int argc, char* argv[])
// Consolidate the SharedBuffer data segments into one, contiguous block of memory.
data->data();
+ // Throw out the first iteration for more consistent data.
+ if (!decodeImageData(data.get(), applyColorCorrection, packetSize)) {
+ fprintf(stderr, "Image decode failed [%s]\n", argv[1]);
+ exit(3);
+ }
+
// Image decode bench for iterations.
double totalTime = 0.0;
« 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