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

Unified Diff: base/files/file_tracing.cc

Issue 1123833003: Revert of Revert some other possible suspects of a 0.43% size increase of setup.exe: https://build.chromium.o… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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/files/file_win.cc » ('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
new file mode 100644
index 0000000000000000000000000000000000000000..3326e2dc6f9aae216ffe114e5284c1f4887e2b71
--- /dev/null
+++ b/base/files/file_tracing.cc
@@ -0,0 +1,47 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/files/file_tracing.h"
+
+#include "base/files/file.h"
+#include "base/files/file_path.h"
+
+namespace base {
+
+const char kFileTracingEventCategoryGroup[] = TRACE_DISABLED_BY_DEFAULT("file");
+
+ScopedFileTrace::ScopedFileTrace() : initialized_(false) {}
+
+ScopedFileTrace::~ScopedFileTrace() {
+ if (initialized_) {
+ if (size_) {
+ TRACE_EVENT_NESTABLE_ASYNC_END2(
+ kFileTracingEventCategoryGroup, name_, &file_->trace_enabler_,
+ "path", file_->path_.AsUTF8Unsafe(), "size", size_);
+ } else {
+ TRACE_EVENT_NESTABLE_ASYNC_END1(
+ kFileTracingEventCategoryGroup, name_, &file_->trace_enabler_,
+ "path", file_->path_.AsUTF8Unsafe());
+ }
+ }
+}
+
+void ScopedFileTrace::Initialize(const char* name, File* file, int64 size) {
+ file_ = file;
+ name_ = name;
+ size_ = size;
+ initialized_ = true;
+
+ if (size_) {
+ TRACE_EVENT_NESTABLE_ASYNC_BEGIN2(
+ kFileTracingEventCategoryGroup, name_, &file_->trace_enabler_,
+ "path", file_->path_.AsUTF8Unsafe(), "size", size_);
+ } else {
+ TRACE_EVENT_NESTABLE_ASYNC_BEGIN1(
+ kFileTracingEventCategoryGroup, name_, &file_->trace_enabler_,
+ "path", file_->path_.AsUTF8Unsafe());
+ }
+}
+
+} // namespace base
« no previous file with comments | « base/files/file_tracing.h ('k') | base/files/file_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698