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

Side by Side Diff: third_party/WebKit/Source/web/ImageDecodeBench.cpp

Issue 1456873003: More regular Platform implementations in unit tests (reland.) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: have GN disable c4267 also Created 5 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifdef WTF 5 #ifdef WTF
6 6
7 Provides a minimal wrapping of the Blink image decoders. Used to perform 7 Provides a minimal wrapping of the Blink image decoders. Used to perform
8 a non-threaded, memory-to-memory image decode using micro second accuracy 8 a non-threaded, memory-to-memory image decode using micro second accuracy
9 clocks to measure image decode time. Optionally applies color correction 9 clocks to measure image decode time. Optionally applies color correction
10 during image decoding on supported platforms (default off). Usage: 10 during image decoding on supported platforms (default off). Usage:
11 11
12 % ninja -C /out/Release image_decode_bench && 12 % ninja -C /out/Release image_decode_bench &&
13 ./out/Release/image_decode_bench file [iterations] 13 ./out/Release/image_decode_bench file [iterations]
14 14
15 FIXME: Consider adding md5 checksum support to WTF. Use it to compute the 15 FIXME: Consider adding md5 checksum support to WTF. Use it to compute the
16 decoded image frame md5 and output that value. 16 decoded image frame md5 and output that value.
17 17
18 FIXME: Consider integrating this tool in Chrome telemetry for realz, using 18 FIXME: Consider integrating this tool in Chrome telemetry for realz, using
19 the image corpii used to assess Blink image decode performance. Refer to 19 the image corpii used to assess Blink image decode performance. Refer to
20 http://crbug.com/398235#c103 and http://crbug.com/258324#c5 20 http://crbug.com/398235#c103 and http://crbug.com/258324#c5
21 21
22 #endif 22 #endif
23 23
24 #include "config.h" 24 #include "config.h"
25 25
26 #include "platform/SharedBuffer.h" 26 #include "platform/SharedBuffer.h"
27 #include "platform/image-decoders/ImageDecoder.h" 27 #include "platform/image-decoders/ImageDecoder.h"
28 #include "platform/testing/TestingPlatformSupport.h"
28 #include "public/platform/Platform.h" 29 #include "public/platform/Platform.h"
29 #include "public/web/WebKit.h" 30 #include "public/web/WebKit.h"
30 #include "wtf/OwnPtr.h" 31 #include "wtf/OwnPtr.h"
31 #include "wtf/PassRefPtr.h" 32 #include "wtf/PassRefPtr.h"
32 33
33 #if defined(_WIN32) 34 #if defined(_WIN32)
34 #if defined(WIN32_LEAN_AND_MEAN) 35 #if defined(WIN32_LEAN_AND_MEAN)
35 #error Fix: WIN32_LEAN_AND_MEAN disables timeBeginPeriod/TimeEndPeriod. 36 #error Fix: WIN32_LEAN_AND_MEAN disables timeBeginPeriod/TimeEndPeriod.
36 #endif 37 #endif
37 #include <mmsystem.h> 38 #include <mmsystem.h>
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 if (*end != '\0') { 354 if (*end != '\0') {
354 fprintf(stderr, "Third argument should be packet size. Default is " 355 fprintf(stderr, "Third argument should be packet size. Default is "
355 "0, meaning to decode the entire image in one packet. You " 356 "0, meaning to decode the entire image in one packet. You "
356 "supplied %s\n", argv[3]); 357 "supplied %s\n", argv[3]);
357 exit(1); 358 exit(1);
358 } 359 }
359 } 360 }
360 361
361 // Create a web platform without V8. 362 // Create a web platform without V8.
362 363
363 class WebPlatform : public blink::Platform { 364 class WebPlatform : public TestingPlatformSupport {
364 public: 365 public:
365 const unsigned char* getTraceCategoryEnabledFlag(const char*) override
366 {
367 return reinterpret_cast<const unsigned char *>("nope-none-nada");
368 }
369
370 void cryptographicallyRandomValues(unsigned char*, size_t) override
371 {
372 RELEASE_ASSERT_NOT_REACHED();
373 }
374
375 void screenColorProfile(WebVector<char>* profile) override 366 void screenColorProfile(WebVector<char>* profile) override
376 { 367 {
377 getScreenColorProfile(profile); // Returns a whacked color profile. 368 getScreenColorProfile(profile); // Returns a whacked color profile.
378 } 369 }
379 }; 370 };
380 371
381 blink::initializeWithoutV8(new WebPlatform()); 372 blink::initializeWithoutV8(new WebPlatform());
382 373
383 // Set image decoding Platform options. 374 // Set image decoding Platform options.
384 375
(...skipping 26 matching lines...) Expand all
411 exit(3); 402 exit(3);
412 } 403 }
413 } 404 }
414 405
415 // Results to stdout. 406 // Results to stdout.
416 407
417 double averageTime = totalTime / static_cast<double>(iterations); 408 double averageTime = totalTime / static_cast<double>(iterations);
418 printf("%f %f\n", totalTime, averageTime); 409 printf("%f %f\n", totalTime, averageTime);
419 return 0; 410 return 0;
420 } 411 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/BUILD.gn ('k') | third_party/WebKit/Source/web/tests/TextFinderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698