diff options
author | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-23 22:00:04 +0000 |
---|---|---|
committer | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-23 22:00:04 +0000 |
commit | b2f2308d0c635418caa3ad2a2560a2778d70a4d5 (patch) | |
tree | daaa5177eb28ddcb2d5582a4e78cf7b0318aea07 /base/platform_file.h | |
parent | 10b6e62953ff6ebc0ac9e7cb7628677da273f79b (diff) | |
download | chromium_src-b2f2308d0c635418caa3ad2a2560a2778d70a4d5.zip chromium_src-b2f2308d0c635418caa3ad2a2560a2778d70a4d5.tar.gz chromium_src-b2f2308d0c635418caa3ad2a2560a2778d70a4d5.tar.bz2 |
Fix PP_FileOpenFlags_Dev handling:
- rewrite the mapping from PP_FileOpenFlags_Dev to PlatformFileFlags.
- let ppb_flash_file_impl and ppb_file_io_impl use the same mapping logic.
- CreatePlatformFile: resolve the conflict between the win and posix implementation. Before this change, the win implementation didn't allow PLATFORM_FILE_TRUNCATE to be used with any of the (OPEN|CREATE)(_ALWAYS)? flags; while the posix implementation required it to be used with them.
- add more test cases to test the behavior of different PP_FileOpenFlags_Dev combinations.
- also unify the conversion from PlatformFileError to Pepper error.
BUG=68489
TEST=New test cases in test_file_io.cc
Review URL: http://codereview.chromium.org/7038032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86349 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/platform_file.h')
-rw-r--r-- | base/platform_file.h | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/base/platform_file.h b/base/platform_file.h index dbac61a..5b29e07 100644 --- a/base/platform_file.h +++ b/base/platform_file.h @@ -28,20 +28,26 @@ typedef int PlatformFile; const PlatformFile kInvalidPlatformFileValue = -1; #endif +// PLATFORM_FILE_(OPEN|CREATE).* are mutually exclusive. You should specify +// exactly one of the five (possibly combining with other flags) when opening +// or creating a file. enum PlatformFileFlags { - PLATFORM_FILE_OPEN = 1, - PLATFORM_FILE_CREATE = 2, - PLATFORM_FILE_OPEN_ALWAYS = 4, // May create a new file. - PLATFORM_FILE_CREATE_ALWAYS = 8, // May overwrite an old file. - PLATFORM_FILE_READ = 16, - PLATFORM_FILE_WRITE = 32, - PLATFORM_FILE_EXCLUSIVE_READ = 64, // EXCLUSIVE is opposite of Windows SHARE - PLATFORM_FILE_EXCLUSIVE_WRITE = 128, - PLATFORM_FILE_ASYNC = 256, - PLATFORM_FILE_TEMPORARY = 512, // Used on Windows only - PLATFORM_FILE_HIDDEN = 1024, // Used on Windows only - PLATFORM_FILE_DELETE_ON_CLOSE = 2048, - PLATFORM_FILE_TRUNCATE = 4096, + PLATFORM_FILE_OPEN = 1, // Opens a file, only if it exists. + PLATFORM_FILE_CREATE = 2, // Creates a new file, only if it does not + // already exist. + PLATFORM_FILE_OPEN_ALWAYS = 4, // May create a new file. + PLATFORM_FILE_CREATE_ALWAYS = 8, // May overwrite an old file. + PLATFORM_FILE_OPEN_TRUNCATED = 16, // Opens a file and truncates it, only if + // it exists. + PLATFORM_FILE_READ = 32, + PLATFORM_FILE_WRITE = 64, + PLATFORM_FILE_EXCLUSIVE_READ = 128, // EXCLUSIVE is opposite of Windows SHARE + PLATFORM_FILE_EXCLUSIVE_WRITE = 256, + PLATFORM_FILE_ASYNC = 512, + PLATFORM_FILE_TEMPORARY = 1024, // Used on Windows only + PLATFORM_FILE_HIDDEN = 2048, // Used on Windows only + PLATFORM_FILE_DELETE_ON_CLOSE = 4096, + PLATFORM_FILE_WRITE_ATTRIBUTES = 8192, // Used on Windows only PLATFORM_FILE_ENUMERATE = 16384, // May enumerate directory }; |