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

Side by Side Diff: base/platform_file.h

Issue 270066: Step 2 in porting disk cache to using FilePath. (Closed)
Patch Set: deprecated Created 11 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
« no previous file with comments | « no previous file | base/platform_file_posix.cc » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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>
11 #endif 11 #endif
12 12
13 #include <string> 13 #include <string>
14 14
15 class FilePath;
16
15 namespace base { 17 namespace base {
16 18
17 #if defined(OS_WIN) 19 #if defined(OS_WIN)
18 typedef HANDLE PlatformFile; 20 typedef HANDLE PlatformFile;
19 const PlatformFile kInvalidPlatformFileValue = INVALID_HANDLE_VALUE; 21 const PlatformFile kInvalidPlatformFileValue = INVALID_HANDLE_VALUE;
20 #elif defined(OS_POSIX) 22 #elif defined(OS_POSIX)
21 typedef int PlatformFile; 23 typedef int PlatformFile;
22 const PlatformFile kInvalidPlatformFileValue = -1; 24 const PlatformFile kInvalidPlatformFileValue = -1;
23 #endif 25 #endif
24 26
25 enum PlatformFileFlags { 27 enum PlatformFileFlags {
26 PLATFORM_FILE_OPEN = 1, 28 PLATFORM_FILE_OPEN = 1,
27 PLATFORM_FILE_CREATE = 2, 29 PLATFORM_FILE_CREATE = 2,
28 PLATFORM_FILE_OPEN_ALWAYS = 4, // May create a new file. 30 PLATFORM_FILE_OPEN_ALWAYS = 4, // May create a new file.
29 PLATFORM_FILE_CREATE_ALWAYS = 8, // May overwrite an old file. 31 PLATFORM_FILE_CREATE_ALWAYS = 8, // May overwrite an old file.
30 PLATFORM_FILE_READ = 16, 32 PLATFORM_FILE_READ = 16,
31 PLATFORM_FILE_WRITE = 32, 33 PLATFORM_FILE_WRITE = 32,
32 PLATFORM_FILE_EXCLUSIVE_READ = 64, // EXCLUSIVE is opposite of Windows SHARE 34 PLATFORM_FILE_EXCLUSIVE_READ = 64, // EXCLUSIVE is opposite of Windows SHARE
33 PLATFORM_FILE_EXCLUSIVE_WRITE = 128, 35 PLATFORM_FILE_EXCLUSIVE_WRITE = 128,
34 PLATFORM_FILE_ASYNC = 256, 36 PLATFORM_FILE_ASYNC = 256,
35 PLATFORM_FILE_TEMPORARY = 512, // Used on Windows only 37 PLATFORM_FILE_TEMPORARY = 512, // Used on Windows only
36 PLATFORM_FILE_HIDDEN = 1024, // Used on Windows only 38 PLATFORM_FILE_HIDDEN = 1024, // Used on Windows only
37 PLATFORM_FILE_DELETE_ON_CLOSE = 2048 39 PLATFORM_FILE_DELETE_ON_CLOSE = 2048
38 }; 40 };
39 41
40 // Creates or opens the given file. If PLATFORM_FILE_OPEN_ALWAYS is used, and 42 // Creates or opens the given file. If PLATFORM_FILE_OPEN_ALWAYS is used, and
41 // |created| is provided, |created| will be set to true if the file was created 43 // |created| is provided, |created| will be set to true if the file was created
42 // or to false in case the file was just opened. 44 // or to false in case the file was just opened.
45 PlatformFile CreatePlatformFile(const FilePath& name,
46 int flags,
47 bool* created);
48 // Deprecated.
43 PlatformFile CreatePlatformFile(const std::wstring& name, 49 PlatformFile CreatePlatformFile(const std::wstring& name,
44 int flags, 50 int flags,
45 bool* created); 51 bool* created);
46 52
47 // Closes a file handle 53 // Closes a file handle
48 bool ClosePlatformFile(PlatformFile file); 54 bool ClosePlatformFile(PlatformFile file);
49 55
50 } // namespace base 56 } // namespace base
51 57
52 #endif // BASE_PLATFORM_FILE_H_ 58 #endif // BASE_PLATFORM_FILE_H_
OLDNEW
« no previous file with comments | « no previous file | base/platform_file_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698