| Index: base/files/file_posix.cc
|
| diff --git a/base/files/file_posix.cc b/base/files/file_posix.cc
|
| index 563dba1cd48a29757df30d2ba50196d5e25757cf..4c790571e8d6aeb732c6abfa038e51a7191edaa1 100644
|
| --- a/base/files/file_posix.cc
|
| +++ b/base/files/file_posix.cc
|
| @@ -10,7 +10,6 @@
|
| #include <unistd.h>
|
|
|
| #include "base/files/file_path.h"
|
| -#include "base/files/file_tracing.h"
|
| #include "base/logging.h"
|
| #include "base/metrics/sparse_histogram.h"
|
| #include "base/posix/eintr_wrapper.h"
|
| @@ -174,7 +173,6 @@ void File::Close() {
|
| if (!IsValid())
|
| return;
|
|
|
| - SCOPED_FILE_TRACE("Close");
|
| ThreadRestrictions::AssertIOAllowed();
|
| file_.reset();
|
| }
|
| @@ -183,8 +181,6 @@ int64 File::Seek(Whence whence, int64 offset) {
|
| ThreadRestrictions::AssertIOAllowed();
|
| DCHECK(IsValid());
|
|
|
| - SCOPED_FILE_TRACE_WITH_SIZE("Seek", offset);
|
| -
|
| #if defined(OS_ANDROID)
|
| COMPILE_ASSERT(sizeof(int64) == sizeof(off64_t), off64_t_64_bit);
|
| return lseek64(file_.get(), static_cast<off64_t>(offset),
|
| @@ -202,8 +198,6 @@ int File::Read(int64 offset, char* data, int size) {
|
| if (size < 0)
|
| return -1;
|
|
|
| - SCOPED_FILE_TRACE_WITH_SIZE("Read", size);
|
| -
|
| int bytes_read = 0;
|
| int rv;
|
| do {
|
| @@ -224,8 +218,6 @@ int File::ReadAtCurrentPos(char* data, int size) {
|
| if (size < 0)
|
| return -1;
|
|
|
| - SCOPED_FILE_TRACE_WITH_SIZE("ReadAtCurrentPos", size);
|
| -
|
| int bytes_read = 0;
|
| int rv;
|
| do {
|
| @@ -242,7 +234,7 @@ int File::ReadAtCurrentPos(char* data, int size) {
|
| int File::ReadNoBestEffort(int64 offset, char* data, int size) {
|
| ThreadRestrictions::AssertIOAllowed();
|
| DCHECK(IsValid());
|
| - SCOPED_FILE_TRACE_WITH_SIZE("ReadNoBestEffort", size);
|
| +
|
| return HANDLE_EINTR(pread(file_.get(), data, size, offset));
|
| }
|
|
|
| @@ -252,7 +244,6 @@ int File::ReadAtCurrentPosNoBestEffort(char* data, int size) {
|
| if (size < 0)
|
| return -1;
|
|
|
| - SCOPED_FILE_TRACE_WITH_SIZE("ReadAtCurrentPosNoBestEffort", size);
|
| return HANDLE_EINTR(read(file_.get(), data, size));
|
| }
|
|
|
| @@ -266,8 +257,6 @@ int File::Write(int64 offset, const char* data, int size) {
|
| if (size < 0)
|
| return -1;
|
|
|
| - SCOPED_FILE_TRACE_WITH_SIZE("Write", size);
|
| -
|
| int bytes_written = 0;
|
| int rv;
|
| do {
|
| @@ -288,8 +277,6 @@ int File::WriteAtCurrentPos(const char* data, int size) {
|
| if (size < 0)
|
| return -1;
|
|
|
| - SCOPED_FILE_TRACE_WITH_SIZE("WriteAtCurrentPos", size);
|
| -
|
| int bytes_written = 0;
|
| int rv;
|
| do {
|
| @@ -310,15 +297,12 @@ int File::WriteAtCurrentPosNoBestEffort(const char* data, int size) {
|
| if (size < 0)
|
| return -1;
|
|
|
| - SCOPED_FILE_TRACE_WITH_SIZE("WriteAtCurrentPosNoBestEffort", size);
|
| return HANDLE_EINTR(write(file_.get(), data, size));
|
| }
|
|
|
| int64 File::GetLength() {
|
| DCHECK(IsValid());
|
|
|
| - SCOPED_FILE_TRACE("GetLength");
|
| -
|
| stat_wrapper_t file_info;
|
| if (CallFstat(file_.get(), &file_info))
|
| return false;
|
| @@ -329,8 +313,6 @@ int64 File::GetLength() {
|
| bool File::SetLength(int64 length) {
|
| ThreadRestrictions::AssertIOAllowed();
|
| DCHECK(IsValid());
|
| -
|
| - SCOPED_FILE_TRACE_WITH_SIZE("SetLength", length);
|
| return !CallFtruncate(file_.get(), length);
|
| }
|
|
|
| @@ -338,8 +320,6 @@ bool File::SetTimes(Time last_access_time, Time last_modified_time) {
|
| ThreadRestrictions::AssertIOAllowed();
|
| DCHECK(IsValid());
|
|
|
| - SCOPED_FILE_TRACE("SetTimes");
|
| -
|
| timeval times[2];
|
| times[0] = last_access_time.ToTimeVal();
|
| times[1] = last_modified_time.ToTimeVal();
|
| @@ -350,8 +330,6 @@ bool File::SetTimes(Time last_access_time, Time last_modified_time) {
|
| bool File::GetInfo(Info* info) {
|
| DCHECK(IsValid());
|
|
|
| - SCOPED_FILE_TRACE("GetInfo");
|
| -
|
| stat_wrapper_t file_info;
|
| if (CallFstat(file_.get(), &file_info))
|
| return false;
|
| @@ -361,12 +339,10 @@ bool File::GetInfo(Info* info) {
|
| }
|
|
|
| File::Error File::Lock() {
|
| - SCOPED_FILE_TRACE("Lock");
|
| return CallFctnlFlock(file_.get(), true);
|
| }
|
|
|
| File::Error File::Unlock() {
|
| - SCOPED_FILE_TRACE("Unlock");
|
| return CallFctnlFlock(file_.get(), false);
|
| }
|
|
|
| @@ -374,8 +350,6 @@ File File::Duplicate() {
|
| if (!IsValid())
|
| return File();
|
|
|
| - SCOPED_FILE_TRACE("Duplicate");
|
| -
|
| PlatformFile other_fd = dup(GetPlatformFile());
|
| if (other_fd == -1)
|
| return File(OSErrorToFileError(errno));
|
| @@ -468,7 +442,7 @@ void File::MemoryCheckingScopedFD::UpdateChecksum() {
|
| // NaCl doesn't implement system calls to open files directly.
|
| #if !defined(OS_NACL)
|
| // TODO(erikkay): does it make sense to support FLAG_EXCLUSIVE_* here?
|
| -void File::DoInitialize(uint32 flags) {
|
| +void File::DoInitialize(const FilePath& name, uint32 flags) {
|
| ThreadRestrictions::AssertIOAllowed();
|
| DCHECK(!IsValid());
|
|
|
| @@ -523,7 +497,7 @@ void File::DoInitialize(uint32 flags) {
|
| mode |= S_IRGRP | S_IROTH;
|
| #endif
|
|
|
| - int descriptor = HANDLE_EINTR(open(path_.value().c_str(), open_flags, mode));
|
| + int descriptor = HANDLE_EINTR(open(name.value().c_str(), open_flags, mode));
|
|
|
| if (flags & FLAG_OPEN_ALWAYS) {
|
| if (descriptor < 0) {
|
| @@ -531,7 +505,7 @@ void File::DoInitialize(uint32 flags) {
|
| if (flags & FLAG_EXCLUSIVE_READ || flags & FLAG_EXCLUSIVE_WRITE)
|
| open_flags |= O_EXCL; // together with O_CREAT implies O_NOFOLLOW
|
|
|
| - descriptor = HANDLE_EINTR(open(path_.value().c_str(), open_flags, mode));
|
| + descriptor = HANDLE_EINTR(open(name.value().c_str(), open_flags, mode));
|
| if (descriptor >= 0)
|
| created_ = true;
|
| }
|
| @@ -546,7 +520,7 @@ void File::DoInitialize(uint32 flags) {
|
| created_ = true;
|
|
|
| if (flags & FLAG_DELETE_ON_CLOSE)
|
| - unlink(path_.value().c_str());
|
| + unlink(name.value().c_str());
|
|
|
| async_ = ((flags & FLAG_ASYNC) == FLAG_ASYNC);
|
| error_details_ = FILE_OK;
|
| @@ -557,7 +531,6 @@ void File::DoInitialize(uint32 flags) {
|
| bool File::DoFlush() {
|
| ThreadRestrictions::AssertIOAllowed();
|
| DCHECK(IsValid());
|
| -
|
| #if defined(OS_NACL)
|
| NOTIMPLEMENTED(); // NaCl doesn't implement fsync.
|
| return true;
|
|
|