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

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

Issue 10383276: Base: Crash when failing to close an scoped handle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #pragma once 7 #pragma once
8 8
9 #include <windows.h> 9 #include <windows.h>
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 Handle Take() { 67 Handle Take() {
68 Handle temp = handle_; 68 Handle temp = handle_;
69 handle_ = Traits::NullHandle(); 69 handle_ = Traits::NullHandle();
70 return temp; 70 return temp;
71 } 71 }
72 72
73 // Explicitly closes the owned handle. 73 // Explicitly closes the owned handle.
74 void Close() { 74 void Close() {
75 if (Traits::IsHandleValid(handle_)) { 75 if (Traits::IsHandleValid(handle_)) {
76 if (!Traits::CloseHandle(handle_)) { 76 if (!Traits::CloseHandle(handle_)) {
77 NOTREACHED(); 77 CHECK(false);
78 } 78 }
79 handle_ = Traits::NullHandle(); 79 handle_ = Traits::NullHandle();
80 } 80 }
81 } 81 }
82 82
83 private: 83 private:
84 Handle handle_; 84 Handle handle_;
85 85
86 DISALLOW_COPY_AND_ASSIGN(GenericScopedHandle); 86 DISALLOW_COPY_AND_ASSIGN(GenericScopedHandle);
87 }; 87 };
(...skipping 21 matching lines...) Expand all
109 private: 109 private:
110 DISALLOW_IMPLICIT_CONSTRUCTORS(HandleTraits); 110 DISALLOW_IMPLICIT_CONSTRUCTORS(HandleTraits);
111 }; 111 };
112 112
113 typedef GenericScopedHandle<HandleTraits> ScopedHandle; 113 typedef GenericScopedHandle<HandleTraits> ScopedHandle;
114 114
115 } // namespace win 115 } // namespace win
116 } // namespace base 116 } // namespace base
117 117
118 #endif // BASE_SCOPED_HANDLE_WIN_H_ 118 #endif // BASE_SCOPED_HANDLE_WIN_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698