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

Unified Diff: base/files/file_tracing.cc

Issue 1149083012: Simplify file tracing end events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: thestig@ review Created 5 years, 6 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/files/file_tracing.h ('k') | base/trace_event/trace_event.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/file_tracing.cc
diff --git a/base/files/file_tracing.cc b/base/files/file_tracing.cc
index a1919c464bb0db922634749c695189a097cd39ba..c25772db8ab5a101f47885ce58016eb576687dd7 100644
--- a/base/files/file_tracing.cc
+++ b/base/files/file_tracing.cc
@@ -27,13 +27,11 @@ FileTracing::ScopedEnabler::~ScopedEnabler() {
g_provider->FileTracingDisable(this);
}
-FileTracing::ScopedTrace::ScopedTrace() : initialized_(false) {}
+FileTracing::ScopedTrace::ScopedTrace() : id_(nullptr) {}
FileTracing::ScopedTrace::~ScopedTrace() {
- if (initialized_ && g_provider) {
- g_provider->FileTracingEventEnd(
- name_, &file_->trace_enabler_, file_->path_, size_);
- }
+ if (id_ && g_provider)
+ g_provider->FileTracingEventEnd(name_, id_);
}
bool FileTracing::ScopedTrace::ShouldInitialize() const {
@@ -42,15 +40,13 @@ bool FileTracing::ScopedTrace::ShouldInitialize() const {
void FileTracing::ScopedTrace::Initialize(
const char* name, File* file, int64 size) {
- file_ = file;
+ if (!g_provider)
+ return;
+
+ id_ = &file->trace_enabler_;
name_ = name;
- size_ = size;
- initialized_ = true;
- if (g_provider) {
- g_provider->FileTracingEventBegin(
- name_, &file_->trace_enabler_, file_->path_, size_);
- }
+ g_provider->FileTracingEventBegin(name_, id_, file->path_, size);
}
} // namespace base
« no previous file with comments | « base/files/file_tracing.h ('k') | base/trace_event/trace_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698