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

Side by Side Diff: base/win/scoped_handle.h

Issue 324773002: Remove base/memory/scoped_handle.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_WIN_SCOPED_HANDLE_H_ 5 #ifndef BASE_WIN_SCOPED_HANDLE_H_
6 #define BASE_WIN_SCOPED_HANDLE_H_ 6 #define BASE_WIN_SCOPED_HANDLE_H_
7 7
8 #include <windows.h> 8 #include <windows.h>
9 9
10 #include "base/base_export.h" 10 #include "base/base_export.h"
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/move.h" 14 #include "base/move.h"
15 15
16 // TODO(rvargas): remove this with the rest of the verifier. 16 // TODO(rvargas): remove this with the rest of the verifier.
17 #if defined(COMPILER_MSVC) 17 #if defined(COMPILER_MSVC)
18 #include <intrin.h> 18 #include <intrin.h>
19 #define BASE_WIN_GET_CALLER _ReturnAddress() 19 #define BASE_WIN_GET_CALLER _ReturnAddress()
20 #elif defined(COMPILER_GCC) 20 #elif defined(COMPILER_GCC)
21 #define BASE_WIN_GET_CALLER __builtin_extract_return_addr(\\ 21 #define BASE_WIN_GET_CALLER __builtin_extract_return_addr(\\
22 __builtin_return_address(0)) 22 __builtin_return_address(0))
23 #endif 23 #endif
24 24
25 namespace base { 25 namespace base {
26 namespace win { 26 namespace win {
27 27
28 // Generic wrapper for raw handles that takes care of closing handles 28 // Generic wrapper for raw handles that takes care of closing handles
29 // automatically. The class interface follows the style of 29 // automatically. The class interface follows the style of
30 // the ScopedStdioHandle class with one addition: 30 // the ScopedFILE class with one addition:
31 // - IsValid() method can tolerate multiple invalid handle values such as NULL 31 // - IsValid() method can tolerate multiple invalid handle values such as NULL
32 // and INVALID_HANDLE_VALUE (-1) for Win32 handles. 32 // and INVALID_HANDLE_VALUE (-1) for Win32 handles.
33 template <class Traits, class Verifier> 33 template <class Traits, class Verifier>
34 class GenericScopedHandle { 34 class GenericScopedHandle {
35 MOVE_ONLY_TYPE_FOR_CPP_03(GenericScopedHandle, RValue) 35 MOVE_ONLY_TYPE_FOR_CPP_03(GenericScopedHandle, RValue)
36 36
37 public: 37 public:
38 typedef typename Traits::Handle Handle; 38 typedef typename Traits::Handle Handle;
39 39
40 GenericScopedHandle() : handle_(Traits::NullHandle()) {} 40 GenericScopedHandle() : handle_(Traits::NullHandle()) {}
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 private: 165 private:
166 DISALLOW_IMPLICIT_CONSTRUCTORS(VerifierTraits); 166 DISALLOW_IMPLICIT_CONSTRUCTORS(VerifierTraits);
167 }; 167 };
168 168
169 typedef GenericScopedHandle<HandleTraits, VerifierTraits> ScopedHandle; 169 typedef GenericScopedHandle<HandleTraits, VerifierTraits> ScopedHandle;
170 170
171 } // namespace win 171 } // namespace win
172 } // namespace base 172 } // namespace base
173 173
174 #endif // BASE_SCOPED_HANDLE_WIN_H_ 174 #endif // BASE_SCOPED_HANDLE_WIN_H_
OLDNEW
« no previous file with comments | « base/memory/scoped_handle.h ('k') | chrome/browser/component_updater/component_patcher_operation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698