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

Side by Side Diff: runtime/vm/timer.h

Issue 269023005: - Ensure that BaseIsolate is only used to break the header include cycles. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_TIMER_H_ 5 #ifndef VM_TIMER_H_
6 #define VM_TIMER_H_ 6 #define VM_TIMER_H_
7 7
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/allocation.h" 9 #include "vm/allocation.h"
10 #include "vm/flags.h" 10 #include "vm/flags.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // The class TimerScope is used to start and stop a timer within a scope. 128 // The class TimerScope is used to start and stop a timer within a scope.
129 // It is used as follows: 129 // It is used as follows:
130 // { 130 // {
131 // TimerScope timer(FLAG_name_of_flag, timer, isolate); 131 // TimerScope timer(FLAG_name_of_flag, timer, isolate);
132 // ..... 132 // .....
133 // code that needs to be timed. 133 // code that needs to be timed.
134 // .... 134 // ....
135 // } 135 // }
136 class TimerScope : public StackResource { 136 class TimerScope : public StackResource {
137 public: 137 public:
138 TimerScope(bool flag, Timer* timer, BaseIsolate* isolate = NULL) 138 TimerScope(bool flag, Timer* timer, Isolate* isolate = NULL)
139 : StackResource(isolate), flag_(flag), nested_(false), timer_(timer) { 139 : StackResource(isolate), flag_(flag), nested_(false), timer_(timer) {
140 if (flag_) { 140 if (flag_) {
141 if (!timer_->running()) { 141 if (!timer_->running()) {
142 timer_->Start(); 142 timer_->Start();
143 } else { 143 } else {
144 nested_ = true; 144 nested_ = true;
145 } 145 }
146 } 146 }
147 } 147 }
148 ~TimerScope() { 148 ~TimerScope() {
149 if (flag_) { 149 if (flag_) {
150 if (!nested_) { 150 if (!nested_) {
151 timer_->Stop(); 151 timer_->Stop();
152 } 152 }
153 } 153 }
154 } 154 }
155 155
156 private: 156 private:
157 const bool flag_; 157 const bool flag_;
158 bool nested_; 158 bool nested_;
159 Timer* const timer_; 159 Timer* const timer_;
160 160
161 DISALLOW_ALLOCATION(); 161 DISALLOW_ALLOCATION();
162 DISALLOW_COPY_AND_ASSIGN(TimerScope); 162 DISALLOW_COPY_AND_ASSIGN(TimerScope);
163 }; 163 };
164 164
165 165
166 class PauseTimerScope : public StackResource { 166 class PauseTimerScope : public StackResource {
167 public: 167 public:
168 PauseTimerScope(bool flag, Timer* timer, BaseIsolate* isolate = NULL) 168 PauseTimerScope(bool flag, Timer* timer, Isolate* isolate = NULL)
169 : StackResource(isolate), flag_(flag), nested_(false), timer_(timer) { 169 : StackResource(isolate), flag_(flag), nested_(false), timer_(timer) {
170 if (flag_) { 170 if (flag_) {
171 if (timer_->running()) { 171 if (timer_->running()) {
172 timer_->Stop(); 172 timer_->Stop();
173 } else { 173 } else {
174 nested_ = true; 174 nested_ = true;
175 } 175 }
176 } 176 }
177 } 177 }
178 ~PauseTimerScope() { 178 ~PauseTimerScope() {
(...skipping 25 matching lines...) Expand all
204 TimerScope vm_internal_timer_(true, &(isolate->timer_list().name()), isolate) 204 TimerScope vm_internal_timer_(true, &(isolate->timer_list().name()), isolate)
205 205
206 #define PAUSETIMERSCOPE(isolate, name) \ 206 #define PAUSETIMERSCOPE(isolate, name) \
207 PauseTimerScope vm_internal_timer_(true, \ 207 PauseTimerScope vm_internal_timer_(true, \
208 &(isolate->timer_list().name()), \ 208 &(isolate->timer_list().name()), \
209 isolate) 209 isolate)
210 210
211 } // namespace dart 211 } // namespace dart
212 212
213 #endif // VM_TIMER_H_ 213 #endif // VM_TIMER_H_
OLDNEW
« runtime/vm/allocation.h ('K') | « runtime/vm/handles.cc ('k') | runtime/vm/zone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698