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

Side by Side Diff: bench/SortBench.cpp

Issue 1037793002: C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: git cl web Created 5 years, 9 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 | « bench/SkipZeroesBench.cpp ('k') | bench/WritePixelsBench.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 2013 Google Inc. 2 * Copyright 2013 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 7
8 #include "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkRandom.h" 9 #include "SkRandom.h"
10 #include "SkString.h" 10 #include "SkString.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 SkString fName; 100 SkString fName;
101 const Type fType; 101 const Type fType;
102 const SortProc fSortProc; 102 const SortProc fSortProc;
103 SkAutoTMalloc<int> fUnsorted; 103 SkAutoTMalloc<int> fUnsorted;
104 104
105 public: 105 public:
106 SortBench(Type t, SortType s) : fType(t), fSortProc(gSorts[s].fProc) { 106 SortBench(Type t, SortType s) : fType(t), fSortProc(gSorts[s].fProc) {
107 fName.printf("sort_%s_%s", gSorts[s].fName, gRec[t].fName); 107 fName.printf("sort_%s_%s", gSorts[s].fName, gRec[t].fName);
108 } 108 }
109 109
110 bool isSuitableFor(Backend backend) SK_OVERRIDE { 110 bool isSuitableFor(Backend backend) override {
111 return backend == kNonRendering_Backend; 111 return backend == kNonRendering_Backend;
112 } 112 }
113 113
114 protected: 114 protected:
115 const char* onGetName() SK_OVERRIDE { 115 const char* onGetName() override {
116 return fName.c_str(); 116 return fName.c_str();
117 } 117 }
118 118
119 // Delayed initialization only done if onDraw will be called. 119 // Delayed initialization only done if onDraw will be called.
120 void onPreDraw() SK_OVERRIDE { 120 void onPreDraw() override {
121 fUnsorted.reset(N); 121 fUnsorted.reset(N);
122 gRec[fType].fProc(fUnsorted.get()); 122 gRec[fType].fProc(fUnsorted.get());
123 } 123 }
124 124
125 void onDraw(const int loops, SkCanvas*) SK_OVERRIDE { 125 void onDraw(const int loops, SkCanvas*) override {
126 SkAutoTMalloc<int> sorted(N); 126 SkAutoTMalloc<int> sorted(N);
127 for (int i = 0; i < loops; i++) { 127 for (int i = 0; i < loops; i++) {
128 memcpy(sorted.get(), fUnsorted.get(), N*sizeof(int)); 128 memcpy(sorted.get(), fUnsorted.get(), N*sizeof(int));
129 fSortProc(sorted.get()); 129 fSortProc(sorted.get());
130 #ifdef SK_DEBUG 130 #ifdef SK_DEBUG
131 for (int j = 1; j < N; ++j) { 131 for (int j = 1; j < N; ++j) {
132 SkASSERT(sorted[j - 1] <= sorted[j]); 132 SkASSERT(sorted[j - 1] <= sorted[j]);
133 } 133 }
134 #endif 134 #endif
135 } 135 }
(...skipping 27 matching lines...) Expand all
163 DEF_BENCH( return NewSkHeap(kFore); ) 163 DEF_BENCH( return NewSkHeap(kFore); )
164 DEF_BENCH( return NewQSort(kFore); ) 164 DEF_BENCH( return NewQSort(kFore); )
165 165
166 DEF_BENCH( return NewSkQSort(kBack); ) 166 DEF_BENCH( return NewSkQSort(kBack); )
167 DEF_BENCH( return NewSkHeap(kBack); ) 167 DEF_BENCH( return NewSkHeap(kBack); )
168 DEF_BENCH( return NewQSort(kBack); ) 168 DEF_BENCH( return NewQSort(kBack); )
169 169
170 DEF_BENCH( return NewSkQSort(kSame); ) 170 DEF_BENCH( return NewSkQSort(kSame); )
171 DEF_BENCH( return NewSkHeap(kSame); ) 171 DEF_BENCH( return NewSkHeap(kSame); )
172 DEF_BENCH( return NewQSort(kSame); ) 172 DEF_BENCH( return NewQSort(kSame); )
OLDNEW
« no previous file with comments | « bench/SkipZeroesBench.cpp ('k') | bench/WritePixelsBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698