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

Unified Diff: runtime/vm/timer.h

Issue 1127383008: Fix CompilerStats info (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/timer.h
===================================================================
--- runtime/vm/timer.h (revision 45749)
+++ runtime/vm/timer.h (working copy)
@@ -125,6 +125,7 @@
DISALLOW_COPY_AND_ASSIGN(TimerList);
};
+
// The class TimerScope is used to start and stop a timer within a scope.
// It is used as follows:
// {
@@ -136,8 +137,10 @@
class TimerScope : public StackResource {
public:
TimerScope(bool flag, Timer* timer, Isolate* isolate = NULL)
- : StackResource(isolate), flag_(flag), nested_(false), timer_(timer) {
- if (flag_) {
+ : StackResource(isolate),
+ nested_(false),
+ timer_(flag ? timer : NULL) {
+ if (timer_ != NULL) {
if (!timer_->running()) {
timer_->Start();
} else {
@@ -146,7 +149,7 @@
}
}
~TimerScope() {
- if (flag_) {
+ if (timer_ != NULL) {
if (!nested_) {
timer_->Stop();
}
@@ -154,7 +157,6 @@
}
private:
- const bool flag_;
bool nested_;
Timer* const timer_;
@@ -166,8 +168,10 @@
class PauseTimerScope : public StackResource {
public:
PauseTimerScope(bool flag, Timer* timer, Isolate* isolate = NULL)
- : StackResource(isolate), flag_(flag), nested_(false), timer_(timer) {
- if (flag_) {
+ : StackResource(isolate),
+ nested_(false),
+ timer_(flag ? timer : NULL) {
+ if (timer_) {
if (timer_->running()) {
timer_->Stop();
} else {
@@ -176,7 +180,7 @@
}
}
~PauseTimerScope() {
- if (flag_) {
+ if (timer_) {
if (!nested_) {
timer_->Start();
}
@@ -184,7 +188,6 @@
}
private:
- const bool flag_;
bool nested_;
Timer* const timer_;
« no previous file with comments | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698