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

Side by Side Diff: base/platform_file_win.cc

Issue 15861011: Add an "append flag" to base::PlatformFile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unnecessary braces Created 7 years, 6 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
« base/platform_file_posix.cc ('K') | « base/platform_file_unittest.cc ('k') | no next file » | 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 #include "base/platform_file.h" 5 #include "base/platform_file.h"
6 6
7 #include <io.h> 7 #include <io.h>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 return NULL; 51 return NULL;
52 } 52 }
53 53
54 DWORD access = (flags & PLATFORM_FILE_READ) ? GENERIC_READ : 0; 54 DWORD access = (flags & PLATFORM_FILE_READ) ? GENERIC_READ : 0;
55 if (flags & PLATFORM_FILE_WRITE) 55 if (flags & PLATFORM_FILE_WRITE)
56 access |= GENERIC_WRITE; 56 access |= GENERIC_WRITE;
57 if (flags & PLATFORM_FILE_WRITE_ATTRIBUTES) 57 if (flags & PLATFORM_FILE_WRITE_ATTRIBUTES)
58 access |= FILE_WRITE_ATTRIBUTES; 58 access |= FILE_WRITE_ATTRIBUTES;
59 if (flags & PLATFORM_FILE_EXECUTE) 59 if (flags & PLATFORM_FILE_EXECUTE)
60 access |= GENERIC_EXECUTE; 60 access |= GENERIC_EXECUTE;
61 if (flags & PLATFORM_FILE_APPEND) {
62 access |= FILE_APPEND_DATA;
63 if (flags & PLATFORM_FILE_WRITE) // Invalid.
64 return NULL;
65 }
61 66
62 DWORD sharing = (flags & PLATFORM_FILE_EXCLUSIVE_READ) ? 0 : FILE_SHARE_READ; 67 DWORD sharing = (flags & PLATFORM_FILE_EXCLUSIVE_READ) ? 0 : FILE_SHARE_READ;
63 if (!(flags & PLATFORM_FILE_EXCLUSIVE_WRITE)) 68 if (!(flags & PLATFORM_FILE_EXCLUSIVE_WRITE))
64 sharing |= FILE_SHARE_WRITE; 69 sharing |= FILE_SHARE_WRITE;
65 if (flags & PLATFORM_FILE_SHARE_DELETE) 70 if (flags & PLATFORM_FILE_SHARE_DELETE)
66 sharing |= FILE_SHARE_DELETE; 71 sharing |= FILE_SHARE_DELETE;
67 72
68 DWORD create_flags = 0; 73 DWORD create_flags = 0;
69 if (flags & PLATFORM_FILE_ASYNC) 74 if (flags & PLATFORM_FILE_ASYNC)
70 create_flags |= FILE_FLAG_OVERLAPPED; 75 create_flags |= FILE_FLAG_OVERLAPPED;
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 case ERROR_DISK_CORRUPT: 291 case ERROR_DISK_CORRUPT:
287 return PLATFORM_FILE_ERROR_IO; 292 return PLATFORM_FILE_ERROR_IO;
288 default: 293 default:
289 UMA_HISTOGRAM_SPARSE_SLOWLY("PlatformFile.UnknownErrors.Windows", 294 UMA_HISTOGRAM_SPARSE_SLOWLY("PlatformFile.UnknownErrors.Windows",
290 last_error); 295 last_error);
291 return PLATFORM_FILE_ERROR_FAILED; 296 return PLATFORM_FILE_ERROR_FAILED;
292 } 297 }
293 } 298 }
294 299
295 } // namespace base 300 } // namespace base
OLDNEW
« base/platform_file_posix.cc ('K') | « base/platform_file_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698