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

Unified Diff: base/profiler/scoped_profile.cc

Issue 669813003: Update from chromium https://crrev.com/301725/ (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 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 | « base/profiler/scoped_profile.h ('k') | base/profiler/scoped_tracker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/profiler/scoped_profile.cc
diff --git a/base/profiler/scoped_profile.cc b/base/profiler/scoped_profile.cc
index e1edc97357cc2726c074976e4e3467c56552899d..8b0ae59a44aa5ef7ce86e0aa28c6288ef9ca0465 100644
--- a/base/profiler/scoped_profile.cc
+++ b/base/profiler/scoped_profile.cc
@@ -13,20 +13,32 @@ namespace tracked_objects {
ScopedProfile::ScopedProfile(const Location& location)
: birth_(ThreadData::TallyABirthIfActive(location)) {
+ if (!birth_)
+ return;
+
ThreadData::PrepareForStartOfRun(birth_);
+ stopwatch_.Start();
}
-ScopedProfile::~ScopedProfile() {
- StopClockAndTally();
-}
+ScopedProfile::ScopedProfile(const Location& location, Mode mode)
+ : birth_(NULL) {
+ if (mode == DISABLED)
+ return;
-void ScopedProfile::StopClockAndTally() {
- stopwatch_.Stop();
+ birth_ = ThreadData::TallyABirthIfActive(location);
+ if (!birth_)
+ return;
+
+ ThreadData::PrepareForStartOfRun(birth_);
+ stopwatch_.Start();
+}
+ScopedProfile::~ScopedProfile() {
if (!birth_)
return;
+
+ stopwatch_.Stop();
ThreadData::TallyRunInAScopedRegionIfTracking(birth_, stopwatch_);
- birth_ = NULL;
}
} // namespace tracked_objects
« no previous file with comments | « base/profiler/scoped_profile.h ('k') | base/profiler/scoped_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698