OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrTraceMarker.h" | 9 #include "GrTraceMarker.h" |
10 #include "GrTracing.h" | 10 #include "GrTracing.h" |
11 #include "SkString.h" | 11 #include "SkString.h" |
12 #include "SkTSort.h" | 12 #include "SkTSort.h" |
13 | 13 |
14 //////////////////////////////////////////////////////////////////////////////// | 14 //////////////////////////////////////////////////////////////////////////////// |
15 | 15 |
16 class GrTraceMarkerSet::Iter { | |
17 public: | |
18 Iter() {}; | |
19 Iter& operator=(const Iter& i) { | |
20 fCurrentIndex = i.fCurrentIndex; | |
21 fMarkers = i.fMarkers; | |
22 return *this; | |
23 } | |
24 bool operator==(const Iter& i) const { | |
25 return fCurrentIndex == i.fCurrentIndex && fMarkers == i.fMarkers; | |
26 } | |
27 bool operator!=(const Iter& i) const { return !(*this == i); } | |
28 const GrGpuTraceMarker& operator*() const { return fMarkers->fMarkerArray[fC
urrentIndex]; } | |
29 Iter& operator++() { | |
30 SkASSERT(*this != fMarkers->end()); | |
31 ++fCurrentIndex; | |
32 return *this; | |
33 } | |
34 | |
35 private: | |
36 friend class GrTraceMarkerSet; | |
37 Iter(const GrTraceMarkerSet* markers, int index) | |
38 : fMarkers(markers), fCurrentIndex(index) { | |
39 SkASSERT(markers); | |
40 } | |
41 | |
42 const GrTraceMarkerSet* fMarkers; | |
43 int fCurrentIndex; | |
44 }; | |
45 | |
46 //////////////////////////////////////////////////////////////////////////////// | 16 //////////////////////////////////////////////////////////////////////////////// |
47 | 17 |
48 GrTraceMarkerSet::GrTraceMarkerSet(const GrTraceMarkerSet& other) { | 18 GrTraceMarkerSet::GrTraceMarkerSet(const GrTraceMarkerSet& other) { |
49 this->addSet(other); | 19 this->addSet(other); |
50 } | 20 } |
51 | 21 |
52 void GrTraceMarkerSet::add(const GrGpuTraceMarker& marker) { | 22 void GrTraceMarkerSet::add(const GrGpuTraceMarker& marker) { |
53 this->fMarkerArray.push(marker); | 23 this->fMarkerArray.push(marker); |
54 } | 24 } |
55 | 25 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 return marker_string; | 77 return marker_string; |
108 } | 78 } |
109 | 79 |
110 GrTraceMarkerSet::Iter GrTraceMarkerSet::begin() const { | 80 GrTraceMarkerSet::Iter GrTraceMarkerSet::begin() const { |
111 return Iter(this, 0); | 81 return Iter(this, 0); |
112 } | 82 } |
113 | 83 |
114 GrTraceMarkerSet::Iter GrTraceMarkerSet::end() const { | 84 GrTraceMarkerSet::Iter GrTraceMarkerSet::end() const { |
115 return Iter(this, this->fMarkerArray.count()); | 85 return Iter(this, this->fMarkerArray.count()); |
116 } | 86 } |
| 87 |
OLD | NEW |