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

Side by Side Diff: bench/ChecksumBench.cpp

Issue 1610823002: Consolidate SK_CRASH and sk_throw into SK_ABORT (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: windows fix Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | bench/nanobench.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "Benchmark.h" 7 #include "Benchmark.h"
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkChecksum.h" 9 #include "SkChecksum.h"
10 #include "SkMD5.h" 10 #include "SkMD5.h"
(...skipping 27 matching lines...) Expand all
38 return backend == kNonRendering_Backend; 38 return backend == kNonRendering_Backend;
39 } 39 }
40 40
41 protected: 41 protected:
42 const char* onGetName() override { 42 const char* onGetName() override {
43 switch (fType) { 43 switch (fType) {
44 case kMD5_ChecksumType: return "compute_md5"; 44 case kMD5_ChecksumType: return "compute_md5";
45 case kSHA1_ChecksumType: return "compute_sha1"; 45 case kSHA1_ChecksumType: return "compute_sha1";
46 case kMurmur3_ChecksumType: return "compute_murmur3"; 46 case kMurmur3_ChecksumType: return "compute_murmur3";
47 47
48 default: SK_CRASH(); return ""; 48 default: SK_ABORT("Invalid Type"); return "";
49 } 49 }
50 } 50 }
51 51
52 void onDraw(int loops, SkCanvas*) override { 52 void onDraw(int loops, SkCanvas*) override {
53 switch (fType) { 53 switch (fType) {
54 case kMD5_ChecksumType: { 54 case kMD5_ChecksumType: {
55 for (int i = 0; i < loops; i++) { 55 for (int i = 0; i < loops; i++) {
56 SkMD5 md5; 56 SkMD5 md5;
57 md5.update(reinterpret_cast<uint8_t*>(fData), sizeof(fData)) ; 57 md5.update(reinterpret_cast<uint8_t*>(fData), sizeof(fData)) ;
58 SkMD5::Digest digest; 58 SkMD5::Digest digest;
(...skipping 20 matching lines...) Expand all
79 79
80 private: 80 private:
81 typedef Benchmark INHERITED; 81 typedef Benchmark INHERITED;
82 }; 82 };
83 83
84 /////////////////////////////////////////////////////////////////////////////// 84 ///////////////////////////////////////////////////////////////////////////////
85 85
86 DEF_BENCH( return new ComputeChecksumBench(kMD5_ChecksumType); ) 86 DEF_BENCH( return new ComputeChecksumBench(kMD5_ChecksumType); )
87 DEF_BENCH( return new ComputeChecksumBench(kSHA1_ChecksumType); ) 87 DEF_BENCH( return new ComputeChecksumBench(kSHA1_ChecksumType); )
88 DEF_BENCH( return new ComputeChecksumBench(kMurmur3_ChecksumType); ) 88 DEF_BENCH( return new ComputeChecksumBench(kMurmur3_ChecksumType); )
OLDNEW
« no previous file with comments | « no previous file | bench/nanobench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698