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

Side by Side Diff: bench/MutexBench.cpp

Issue 1214603003: Revert of Remove SkThread.h, include SkMutex.h or SkAtomics.h as appropriate. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 5 years, 5 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/RefCntBench.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 2011 Google Inc. 2 * Copyright 2011 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 "SkMutex.h" 8 #include "SkThread.h"
9 9
10 class MutexBench : public Benchmark { 10 class MutexBench : public Benchmark {
11 public: 11 public:
12 bool isSuitableFor(Backend backend) override { 12 bool isSuitableFor(Backend backend) override {
13 return backend == kNonRendering_Backend; 13 return backend == kNonRendering_Backend;
14 } 14 }
15 15
16 protected: 16 protected:
17 virtual const char* onGetName() { 17 virtual const char* onGetName() {
18 return "mutex"; 18 return "mutex";
19 } 19 }
20 20
21 virtual void onDraw(const int loops, SkCanvas*) { 21 virtual void onDraw(const int loops, SkCanvas*) {
22 SkMutex mu; 22 SkMutex mu;
23 for (int i = 0; i < loops; i++) { 23 for (int i = 0; i < loops; i++) {
24 mu.acquire(); 24 mu.acquire();
25 mu.release(); 25 mu.release();
26 } 26 }
27 } 27 }
28 28
29 private: 29 private:
30 typedef Benchmark INHERITED; 30 typedef Benchmark INHERITED;
31 }; 31 };
32 32
33 /////////////////////////////////////////////////////////////////////////////// 33 ///////////////////////////////////////////////////////////////////////////////
34 34
35 DEF_BENCH( return new MutexBench(); ) 35 DEF_BENCH( return new MutexBench(); )
OLDNEW
« no previous file with comments | « no previous file | bench/RefCntBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698