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

Side by Side Diff: base/platform_file.h

Issue 26513005: Report errors from ChromiumEnv::GetChildren in Posix. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add comment to PlatformFileError Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | third_party/leveldatabase/env_chromium.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef BASE_PLATFORM_FILE_H_ 5 #ifndef BASE_PLATFORM_FILE_H_
6 #define BASE_PLATFORM_FILE_H_ 6 #define BASE_PLATFORM_FILE_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 PLATFORM_FILE_WRITE_ATTRIBUTES = 1 << 14, // Used on Windows only 48 PLATFORM_FILE_WRITE_ATTRIBUTES = 1 << 14, // Used on Windows only
49 49
50 PLATFORM_FILE_SHARE_DELETE = 1 << 15, // Used on Windows only 50 PLATFORM_FILE_SHARE_DELETE = 1 << 15, // Used on Windows only
51 51
52 PLATFORM_FILE_TERMINAL_DEVICE = 1 << 16, // Serial port flags 52 PLATFORM_FILE_TERMINAL_DEVICE = 1 << 16, // Serial port flags
53 PLATFORM_FILE_BACKUP_SEMANTICS = 1 << 17, // Used on Windows only 53 PLATFORM_FILE_BACKUP_SEMANTICS = 1 << 17, // Used on Windows only
54 54
55 PLATFORM_FILE_EXECUTE = 1 << 18, // Used on Windows only 55 PLATFORM_FILE_EXECUTE = 1 << 18, // Used on Windows only
56 }; 56 };
57 57
58 // This enum has been recorded in multiple histograms. If the order of the
59 // fields needs to change, please ensure that those histograms are obsolete or
60 // have been moved to a different enum.
dgrogan 2013/10/18 21:54:10 thakis@, please take a look
61 //
58 // PLATFORM_FILE_ERROR_ACCESS_DENIED is returned when a call fails because of 62 // PLATFORM_FILE_ERROR_ACCESS_DENIED is returned when a call fails because of
59 // a filesystem restriction. PLATFORM_FILE_ERROR_SECURITY is returned when a 63 // a filesystem restriction. PLATFORM_FILE_ERROR_SECURITY is returned when a
60 // browser policy doesn't allow the operation to be executed. 64 // browser policy doesn't allow the operation to be executed.
61 enum PlatformFileError { 65 enum PlatformFileError {
62 PLATFORM_FILE_OK = 0, 66 PLATFORM_FILE_OK = 0,
63 PLATFORM_FILE_ERROR_FAILED = -1, 67 PLATFORM_FILE_ERROR_FAILED = -1,
64 PLATFORM_FILE_ERROR_IN_USE = -2, 68 PLATFORM_FILE_ERROR_IN_USE = -2,
65 PLATFORM_FILE_ERROR_EXISTS = -3, 69 PLATFORM_FILE_ERROR_EXISTS = -3,
66 PLATFORM_FILE_ERROR_NOT_FOUND = -4, 70 PLATFORM_FILE_ERROR_NOT_FOUND = -4,
67 PLATFORM_FILE_ERROR_ACCESS_DENIED = -5, 71 PLATFORM_FILE_ERROR_ACCESS_DENIED = -5,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 base::Time creation_time; 119 base::Time creation_time;
116 }; 120 };
117 121
118 #if defined(OS_WIN) 122 #if defined(OS_WIN)
119 typedef HANDLE PlatformFile; 123 typedef HANDLE PlatformFile;
120 const PlatformFile kInvalidPlatformFileValue = INVALID_HANDLE_VALUE; 124 const PlatformFile kInvalidPlatformFileValue = INVALID_HANDLE_VALUE;
121 PlatformFileError LastErrorToPlatformFileError(DWORD saved_errno); 125 PlatformFileError LastErrorToPlatformFileError(DWORD saved_errno);
122 #elif defined(OS_POSIX) 126 #elif defined(OS_POSIX)
123 typedef int PlatformFile; 127 typedef int PlatformFile;
124 const PlatformFile kInvalidPlatformFileValue = -1; 128 const PlatformFile kInvalidPlatformFileValue = -1;
125 PlatformFileError ErrnoToPlatformFileError(int saved_errno); 129 BASE_EXPORT PlatformFileError ErrnoToPlatformFileError(int saved_errno);
126 #endif 130 #endif
127 131
128 // Creates or opens the given file. If |created| is provided, it will be set to 132 // Creates or opens the given file. If |created| is provided, it will be set to
129 // true if a new file was created [or an old one truncated to zero length to 133 // true if a new file was created [or an old one truncated to zero length to
130 // simulate a new file, which can happen with PLATFORM_FILE_CREATE_ALWAYS], and 134 // simulate a new file, which can happen with PLATFORM_FILE_CREATE_ALWAYS], and
131 // false otherwise. |error| can be NULL. 135 // false otherwise. |error| can be NULL.
132 // 136 //
133 // This function fails with 'access denied' if the |name| contains path 137 // This function fails with 'access denied' if the |name| contains path
134 // traversal ('..') components. 138 // traversal ('..') components.
135 BASE_EXPORT PlatformFile CreatePlatformFile(const FilePath& name, 139 BASE_EXPORT PlatformFile CreatePlatformFile(const FilePath& name,
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 return temp; 275 return temp;
272 } 276 }
273 277
274 private: 278 private:
275 PlatformFile* value_; 279 PlatformFile* value_;
276 }; 280 };
277 281
278 } // namespace base 282 } // namespace base
279 283
280 #endif // BASE_PLATFORM_FILE_H_ 284 #endif // BASE_PLATFORM_FILE_H_
OLDNEW
« no previous file with comments | « no previous file | third_party/leveldatabase/env_chromium.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698