Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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
3 // found in the LICENSE file.
5 #ifndef BASE_PLATFORM_FILE_H_
6 #define BASE_PLATFORM_FILE_H_
8 #include "build/build_config.h"
9 #if defined(OS_WIN)
10 #include <windows.h>
11 #endif
13 #include <string>
15 namespace base {
17 #if defined(OS_WIN)
18 typedef HANDLE PlatformFile;
19 const PlatformFile kInvalidPlatformFileValue = INVALID_HANDLE_VALUE;
20 #elif defined(OS_POSIX)
21 typedef int PlatformFile;
22 const PlatformFile kInvalidPlatformFileValue = -1;
23 #endif
25 enum PlatformFileFlags {
26 PLATFORM_FILE_OPEN = 1,
27 PLATFORM_FILE_CREATE = 2,
28 PLATFORM_FILE_OPEN_ALWAYS = 4, // May create a new file.
29 PLATFORM_FILE_CREATE_ALWAYS = 8, // May overwrite an old file.
30 PLATFORM_FILE_READ = 16,
31 PLATFORM_FILE_WRITE = 32,
32 PLATFORM_FILE_EXCLUSIVE_READ = 64, // EXCLUSIVE is opposite of Windows SHARE
33 PLATFORM_FILE_EXCLUSIVE_WRITE = 128,
34 PLATFORM_FILE_ASYNC = 256
35 };
37 // Creates or open the given file. If PLATFORM_FILE_OPEN_ALWAYS is used, and
38 // |created| is provided, |created| will be set to true if the file was created
39 // or to false in case the file was just opened.
40 PlatformFile CreatePlatformFile(const std::wstring& name,
41 int flags,
42 bool* created);
44 } // namespace base
46 #endif // BASE_PLATFORM_FILE_H_