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 "sandbox/win/src/handle_closer_agent.h" | 5 #include "sandbox/win/src/handle_closer_agent.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "sandbox/win/src/nt_internals.h" | 8 #include "sandbox/win/src/nt_internals.h" |
9 #include "sandbox/win/src/win_utils.h" | 9 #include "sandbox/win/src/win_utils.h" |
10 | 10 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 CHECK(name.second); | 113 CHECK(name.second); |
114 input += name.first->size() + 1; | 114 input += name.first->size() + 1; |
115 } | 115 } |
116 | 116 |
117 // Move on to the next entry. | 117 // Move on to the next entry. |
118 entry = reinterpret_cast<HandleListEntry*>(reinterpret_cast<char*>(entry) | 118 entry = reinterpret_cast<HandleListEntry*>(reinterpret_cast<char*>(entry) |
119 + entry->record_bytes); | 119 + entry->record_bytes); |
120 | 120 |
121 DCHECK(reinterpret_cast<base::char16*>(entry) >= input); | 121 DCHECK(reinterpret_cast<base::char16*>(entry) >= input); |
122 DCHECK(reinterpret_cast<base::char16*>(entry) - input < | 122 DCHECK(reinterpret_cast<base::char16*>(entry) - input < |
123 sizeof(size_t) / sizeof(base::char16)); | 123 static_cast<ptrdiff_t>(sizeof(size_t) / sizeof(base::char16))); |
124 } | 124 } |
125 | 125 |
126 // Clean up the memory we copied over. | 126 // Clean up the memory we copied over. |
127 ::VirtualFree(g_handles_to_close, 0, MEM_RELEASE); | 127 ::VirtualFree(g_handles_to_close, 0, MEM_RELEASE); |
128 g_handles_to_close = NULL; | 128 g_handles_to_close = NULL; |
129 } | 129 } |
130 | 130 |
131 bool HandleCloserAgent::CloseHandles() { | 131 bool HandleCloserAgent::CloseHandles() { |
132 DWORD handle_count = UINT_MAX; | 132 DWORD handle_count = UINT_MAX; |
133 const int kInvalidHandleThreshold = 100; | 133 const int kInvalidHandleThreshold = 100; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 return false; | 191 return false; |
192 // Attempt to stuff this handle with a new dummy Event. | 192 // Attempt to stuff this handle with a new dummy Event. |
193 AttemptToStuffHandleSlot(handle, result->first); | 193 AttemptToStuffHandleSlot(handle, result->first); |
194 } | 194 } |
195 } | 195 } |
196 | 196 |
197 return true; | 197 return true; |
198 } | 198 } |
199 | 199 |
200 } // namespace sandbox | 200 } // namespace sandbox |
OLD | NEW |