| Index: base/files/scoped_file.h
|
| diff --git a/base/files/scoped_file.h b/base/files/scoped_file.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c7cd45238bf2d034934df5b80ea9d44c4676bd6b
|
| --- /dev/null
|
| +++ b/base/files/scoped_file.h
|
| @@ -0,0 +1,37 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef BASE_FILES_SCOPED_FILE_H_
|
| +#define BASE_FILES_SCOPED_FILE_H_
|
| +
|
| +#include <stdio.h>
|
| +
|
| +#include "base/base_export.h"
|
| +#include "base/logging.h"
|
| +#include "base/scoped_generic.h"
|
| +#include "build/build_config.h"
|
| +
|
| +namespace base {
|
| +
|
| +namespace internal {
|
| +
|
| +#if defined(OS_POSIX)
|
| +struct BASE_EXPORT ScopedFDCloseTraits {
|
| + static int InvalidValue() {
|
| + return -1;
|
| + }
|
| + static void Free(int fd);
|
| +};
|
| +#endif
|
| +
|
| +} // namespace internal
|
| +
|
| +#if defined(OS_POSIX)
|
| +// Scoped file descriptor.
|
| +typedef ScopedGeneric<int, internal::ScopedFDCloseTraits> ScopedFD;
|
| +#endif
|
| +
|
| +} // namespace base
|
| +
|
| +#endif // BASE_FILES_SCOPED_FILE_H_
|
|
|