ipc/chromium/src/base/platform_file.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ipc/chromium/src/base/platform_file.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,46 @@
     1.4 +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
     1.5 +// Use of this source code is governed by a BSD-style license that can be
     1.6 +// found in the LICENSE file.
     1.7 +
     1.8 +#ifndef BASE_PLATFORM_FILE_H_
     1.9 +#define BASE_PLATFORM_FILE_H_
    1.10 +
    1.11 +#include "build/build_config.h"
    1.12 +#if defined(OS_WIN)
    1.13 +#include <windows.h>
    1.14 +#endif
    1.15 +
    1.16 +#include <string>
    1.17 +
    1.18 +namespace base {
    1.19 +
    1.20 +#if defined(OS_WIN)
    1.21 +typedef HANDLE PlatformFile;
    1.22 +const PlatformFile kInvalidPlatformFileValue = INVALID_HANDLE_VALUE;
    1.23 +#elif defined(OS_POSIX)
    1.24 +typedef int PlatformFile;
    1.25 +const PlatformFile kInvalidPlatformFileValue = -1;
    1.26 +#endif
    1.27 +
    1.28 +enum PlatformFileFlags {
    1.29 +  PLATFORM_FILE_OPEN = 1,
    1.30 +  PLATFORM_FILE_CREATE = 2,
    1.31 +  PLATFORM_FILE_OPEN_ALWAYS = 4,    // May create a new file.
    1.32 +  PLATFORM_FILE_CREATE_ALWAYS = 8,  // May overwrite an old file.
    1.33 +  PLATFORM_FILE_READ = 16,
    1.34 +  PLATFORM_FILE_WRITE = 32,
    1.35 +  PLATFORM_FILE_EXCLUSIVE_READ = 64,  // EXCLUSIVE is opposite of Windows SHARE
    1.36 +  PLATFORM_FILE_EXCLUSIVE_WRITE = 128,
    1.37 +  PLATFORM_FILE_ASYNC = 256
    1.38 +};
    1.39 +
    1.40 +// Creates or open the given file. If PLATFORM_FILE_OPEN_ALWAYS is used, and
    1.41 +// |created| is provided, |created| will be set to true if the file was created
    1.42 +// or to false in case the file was just opened.
    1.43 +PlatformFile CreatePlatformFile(const std::wstring& name,
    1.44 +                                int flags,
    1.45 +                                bool* created);
    1.46 +
    1.47 +}  // namespace base
    1.48 +
    1.49 +#endif  // BASE_PLATFORM_FILE_H_

mercurial