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

Unified Diff: base/files/file.cc

Issue 1072133006: Add granular file tracing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@do-initialize
Patch Set: comment 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 | « base/files/file.h ('k') | base/files/file_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/file.cc
diff --git a/base/files/file.cc b/base/files/file.cc
index 8030bf13734e8a6b20bfe4f8f45ccc738885e075..58f80c52322ec38125e1acbe3fda1120f64aa912 100644
--- a/base/files/file.cc
+++ b/base/files/file.cc
@@ -4,6 +4,7 @@
#include "base/files/file.h"
#include "base/files/file_path.h"
+#include "base/files/file_tracing.h"
#include "base/metrics/histogram.h"
#include "base/timer/elapsed_timer.h"
@@ -25,11 +26,11 @@ File::File()
}
#if !defined(OS_NACL)
-File::File(const FilePath& name, uint32 flags)
+File::File(const FilePath& path, uint32 flags)
: error_details_(FILE_OK),
created_(false),
async_(false) {
- Initialize(name, flags);
+ Initialize(path, flags);
}
#endif
@@ -51,6 +52,7 @@ File::File(Error error_details)
File::File(RValue other)
: file_(other.object->TakePlatformFile()),
+ path_(other.object->path_),
error_details_(other.object->error_details()),
created_(other.object->created()),
async_(other.object->async_) {
@@ -65,6 +67,7 @@ File& File::operator=(RValue other) {
if (this != other.object) {
Close();
SetPlatformFile(other.object->TakePlatformFile());
+ path_ = other.object->path_;
error_details_ = other.object->error_details();
created_ = other.object->created();
async_ = other.object->async_;
@@ -73,12 +76,14 @@ File& File::operator=(RValue other) {
}
#if !defined(OS_NACL)
-void File::Initialize(const FilePath& name, uint32 flags) {
- if (name.ReferencesParent()) {
+void File::Initialize(const FilePath& path, uint32 flags) {
+ if (path.ReferencesParent()) {
error_details_ = FILE_ERROR_ACCESS_DENIED;
return;
}
- DoInitialize(name, flags);
+ path_ = path;
+ SCOPED_FILE_TRACE("Initialize");
+ DoInitialize(flags);
}
#endif
@@ -128,6 +133,7 @@ std::string File::ErrorToString(Error error) {
bool File::Flush() {
ElapsedTimer timer;
+ SCOPED_FILE_TRACE("Flush");
bool return_value = DoFlush();
UMA_HISTOGRAM_TIMES("PlatformFile.FlushTime", timer.Elapsed());
return return_value;
« no previous file with comments | « base/files/file.h ('k') | base/files/file_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698