| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/files/file.h" | 5 #include "base/files/file.h" |
| 6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/timer/elapsed_timer.h" | 8 #include "base/timer/elapsed_timer.h" |
| 9 | 9 |
| 10 #if defined(OS_POSIX) | 10 #if defined(OS_POSIX) |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 return *this; | 82 return *this; |
| 83 } | 83 } |
| 84 | 84 |
| 85 #if !defined(OS_NACL) | 85 #if !defined(OS_NACL) |
| 86 void File::Initialize(const FilePath& name, uint32 flags) { | 86 void File::Initialize(const FilePath& name, uint32 flags) { |
| 87 if (name.ReferencesParent()) { | 87 if (name.ReferencesParent()) { |
| 88 error_details_ = FILE_ERROR_ACCESS_DENIED; | 88 error_details_ = FILE_ERROR_ACCESS_DENIED; |
| 89 return; | 89 return; |
| 90 } | 90 } |
| 91 InitializeUnsafe(name, flags); | 91 DoInitialize(name, flags); |
| 92 } | 92 } |
| 93 #endif | 93 #endif |
| 94 | 94 |
| 95 std::string File::ErrorToString(Error error) { | 95 std::string File::ErrorToString(Error error) { |
| 96 switch (error) { | 96 switch (error) { |
| 97 case FILE_OK: | 97 case FILE_OK: |
| 98 return "FILE_OK"; | 98 return "FILE_OK"; |
| 99 case FILE_ERROR_FAILED: | 99 case FILE_ERROR_FAILED: |
| 100 return "FILE_ERROR_FAILED"; | 100 return "FILE_ERROR_FAILED"; |
| 101 case FILE_ERROR_IN_USE: | 101 case FILE_ERROR_IN_USE: |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 } | 137 } |
| 138 | 138 |
| 139 bool File::Flush() { | 139 bool File::Flush() { |
| 140 ElapsedTimer timer; | 140 ElapsedTimer timer; |
| 141 bool return_value = DoFlush(); | 141 bool return_value = DoFlush(); |
| 142 UMA_HISTOGRAM_TIMES("PlatformFile.FlushTime", timer.Elapsed()); | 142 UMA_HISTOGRAM_TIMES("PlatformFile.FlushTime", timer.Elapsed()); |
| 143 return return_value; | 143 return return_value; |
| 144 } | 144 } |
| 145 | 145 |
| 146 } // namespace base | 146 } // namespace base |
| OLD | NEW |