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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <unordered_map> | 9 #include <unordered_map> |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 const void* pc2; | 39 const void* pc2; |
40 base::debug::StackTrace stack; | 40 base::debug::StackTrace stack; |
41 DWORD thread_id; | 41 DWORD thread_id; |
42 }; | 42 }; |
43 typedef std::unordered_map<HANDLE, Info, HandleHash> HandleMap; | 43 typedef std::unordered_map<HANDLE, Info, HandleHash> HandleMap; |
44 | 44 |
45 // GetLock() protects the handle map and setting g_active_verifier within this | 45 // GetLock() protects the handle map and setting g_active_verifier within this |
46 // module. | 46 // module. |
47 typedef base::internal::LockImpl NativeLock; | 47 typedef base::internal::LockImpl NativeLock; |
48 NativeLock* GetLock() { | 48 NativeLock* GetLock() { |
49 static auto native_lock = new NativeLock(); | 49 static auto* native_lock = new NativeLock(); |
50 return native_lock; | 50 return native_lock; |
51 } | 51 } |
52 | 52 |
53 // Simple automatic locking using a native critical section so it supports | 53 // Simple automatic locking using a native critical section so it supports |
54 // recursive locking. | 54 // recursive locking. |
55 class AutoNativeLock { | 55 class AutoNativeLock { |
56 public: | 56 public: |
57 explicit AutoNativeLock(NativeLock& lock) : lock_(lock) { | 57 explicit AutoNativeLock(NativeLock& lock) : lock_(lock) { |
58 lock_.Lock(); | 58 lock_.Lock(); |
59 } | 59 } |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 void OnHandleBeingClosed(HANDLE handle) { | 282 void OnHandleBeingClosed(HANDLE handle) { |
283 return ActiveVerifier::Get()->OnHandleBeingClosed(handle); | 283 return ActiveVerifier::Get()->OnHandleBeingClosed(handle); |
284 } | 284 } |
285 | 285 |
286 HMODULE GetHandleVerifierModuleForTesting() { | 286 HMODULE GetHandleVerifierModuleForTesting() { |
287 return g_active_verifier->GetModule(); | 287 return g_active_verifier->GetModule(); |
288 } | 288 } |
289 | 289 |
290 } // namespace win | 290 } // namespace win |
291 } // namespace base | 291 } // namespace base |
OLD | NEW |