OLD | NEW |
---|---|
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 #include "base/win/scoped_handle.h" | 5 #include "base/win/scoped_handle.h" |
6 | 6 |
7 #include <unordered_map> | 7 #include <unordered_map> |
8 | 8 |
9 #include "base/debug/alias.h" | 9 #include "base/debug/alias.h" |
10 #include "base/hash.h" | 10 #include "base/hash.h" |
(...skipping 22 matching lines...) Expand all Loading... | |
33 const void* pc2; | 33 const void* pc2; |
34 DWORD thread_id; | 34 DWORD thread_id; |
35 }; | 35 }; |
36 typedef std::unordered_map<HANDLE, Info, HandleHash> HandleMap; | 36 typedef std::unordered_map<HANDLE, Info, HandleHash> HandleMap; |
37 | 37 |
38 // g_lock protects the handle map and setting g_active_verifier. | 38 // g_lock protects the handle map and setting g_active_verifier. |
39 typedef base::internal::LockImpl NativeLock; | 39 typedef base::internal::LockImpl NativeLock; |
40 base::LazyInstance<NativeLock>::Leaky g_lock = LAZY_INSTANCE_INITIALIZER; | 40 base::LazyInstance<NativeLock>::Leaky g_lock = LAZY_INSTANCE_INITIALIZER; |
41 | 41 |
42 bool CloseHandleWrapper(HANDLE handle) { | 42 bool CloseHandleWrapper(HANDLE handle) { |
43 if (!::CloseHandle(handle)) | 43 if (!::CloseHandle(handle)) { |
44 CHECK(false); | 44 DCHECK(false); |
grt (UTC plus 2)
2015/04/28 01:54:03
return false in this case. how about:
if (::Clos
Shrikant Kelkar
2015/04/28 17:59:10
Done.
| |
45 } | |
45 return true; | 46 return true; |
46 } | 47 } |
47 | 48 |
48 // Simple automatic locking using a native critical section so it supports | 49 // Simple automatic locking using a native critical section so it supports |
49 // recursive locking. | 50 // recursive locking. |
50 class AutoNativeLock { | 51 class AutoNativeLock { |
51 public: | 52 public: |
52 explicit AutoNativeLock(NativeLock& lock) : lock_(lock) { | 53 explicit AutoNativeLock(NativeLock& lock) : lock_(lock) { |
53 lock_.Lock(); | 54 lock_.Lock(); |
54 } | 55 } |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
237 void DisableHandleVerifier() { | 238 void DisableHandleVerifier() { |
238 return ActiveVerifier::Get()->Disable(); | 239 return ActiveVerifier::Get()->Disable(); |
239 } | 240 } |
240 | 241 |
241 void OnHandleBeingClosed(HANDLE handle) { | 242 void OnHandleBeingClosed(HANDLE handle) { |
242 return ActiveVerifier::Get()->OnHandleBeingClosed(handle); | 243 return ActiveVerifier::Get()->OnHandleBeingClosed(handle); |
243 } | 244 } |
244 | 245 |
245 } // namespace win | 246 } // namespace win |
246 } // namespace base | 247 } // namespace base |
OLD | NEW |