Revert of Revert some other possible suspects of a 0.43% size increase of setup.exe: https://build.chromium.o… (patchset #1 id:1 of https://codereview.chromium.org/1124563003/)

Reason for revert:
Broke the compile because one of these CLs is already depended on (rch@'s bce10d97d6fc5233071427cf622aaad7abde9e19).

Original issue's description:
> Revert some other possible suspects of a 0.43% size increase of setup.exe: https://build.chromium.org/p/chromium/builders/Win/builds/31562
>
>   Revert "Add granular base::File tracing."
>
>   This reverts commit a6e05c977096a03774e5406d63ad80c0166f9adc.
>
>   Revert "Add AllReadDataConsumed and AllWriteDataConsumed methods to SocketDataProvider"
>
>   This reverts commit bce10d97d6fc5233071427cf622aaad7abde9e19.
>
>   Revert "Avoid unnecessary memory allocations at PlatformThread::SetName()"
>
>   This reverts commit 4839a142bf95776323647c82ca9dc0725f7c4f15.
>
> TBR=tdresser@chromium.org
> BUG=none
> TEST=green sizes
>
> Committed: https://chromium.googlesource.com/chromium/src/+/c41830d6f55f85e2f5c8841db4b6ed81239b671d

TBR=tdresser@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=none

Review URL: https://codereview.chromium.org/1123833003

Cr-Commit-Position: refs/heads/master@{#328207}


CrOS-Libchrome-Original-Commit: eb1e4d1dd2511083e1d5506d1edfbdff68e133cc
diff --git a/base/files/file.cc b/base/files/file.cc
index 8030bf1..774539f 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 @@
 }
 
 #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(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 @@
   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 @@
 }
 
 #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,9 +133,18 @@
 
 bool File::Flush() {
   ElapsedTimer timer;
+  SCOPED_FILE_TRACE("Flush");
   bool return_value = DoFlush();
   UMA_HISTOGRAM_TIMES("PlatformFile.FlushTime", timer.Elapsed());
   return return_value;
 }
 
+File::TraceEnabler::TraceEnabler() {
+  FILE_TRACING_BEGIN();
+}
+
+File::TraceEnabler::~TraceEnabler() {
+  FILE_TRACING_END();
+}
+
 }  // namespace base