| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SCOPED_HANDLE_H_ | 5 #ifndef BASE_SCOPED_HANDLE_H_ |
| 6 #define BASE_SCOPED_HANDLE_H_ | 6 #define BASE_SCOPED_HANDLE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <stdio.h> | 9 #include <stdio.h> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 | 12 |
| 13 #if defined(OS_WIN) | |
| 14 #include "base/scoped_handle_win.h" | |
| 15 #endif | |
| 16 | |
| 17 class ScopedStdioHandle { | 13 class ScopedStdioHandle { |
| 18 public: | 14 public: |
| 19 ScopedStdioHandle() | 15 ScopedStdioHandle() |
| 20 : handle_(NULL) { } | 16 : handle_(NULL) { } |
| 21 | 17 |
| 22 explicit ScopedStdioHandle(FILE* handle) | 18 explicit ScopedStdioHandle(FILE* handle) |
| 23 : handle_(handle) { } | 19 : handle_(handle) { } |
| 24 | 20 |
| 25 ~ScopedStdioHandle() { | 21 ~ScopedStdioHandle() { |
| 26 Close(); | 22 Close(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 46 handle_ = newhandle; | 42 handle_ = newhandle; |
| 47 } | 43 } |
| 48 | 44 |
| 49 private: | 45 private: |
| 50 FILE* handle_; | 46 FILE* handle_; |
| 51 | 47 |
| 52 DISALLOW_COPY_AND_ASSIGN(ScopedStdioHandle); | 48 DISALLOW_COPY_AND_ASSIGN(ScopedStdioHandle); |
| 53 }; | 49 }; |
| 54 | 50 |
| 55 #endif // BASE_SCOPED_HANDLE_H_ | 51 #endif // BASE_SCOPED_HANDLE_H_ |
| OLD | NEW |