| 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 <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 break; | 78 break; |
| 79 if (dup_dummy != closed_handle) | 79 if (dup_dummy != closed_handle) |
| 80 to_close.push_back(dup_dummy); | 80 to_close.push_back(dup_dummy); |
| 81 } while (count-- && | 81 } while (count-- && |
| 82 reinterpret_cast<uintptr_t>(dup_dummy) < | 82 reinterpret_cast<uintptr_t>(dup_dummy) < |
| 83 reinterpret_cast<uintptr_t>(closed_handle)); | 83 reinterpret_cast<uintptr_t>(closed_handle)); |
| 84 | 84 |
| 85 for (HANDLE h : to_close) | 85 for (HANDLE h : to_close) |
| 86 ::CloseHandle(h); | 86 ::CloseHandle(h); |
| 87 | 87 |
| 88 // Useful to know when we're not able to stuff handles. | 88 // TODO(wfh): Investigate why stuffing handles sometimes fails. |
| 89 DCHECK(dup_dummy == closed_handle); | 89 // http://crbug.com/649904 |
| 90 | |
| 91 return dup_dummy == closed_handle; | 90 return dup_dummy == closed_handle; |
| 92 } | 91 } |
| 93 | 92 |
| 94 // Reads g_handles_to_close and creates the lookup map. | 93 // Reads g_handles_to_close and creates the lookup map. |
| 95 void HandleCloserAgent::InitializeHandlesToClose(bool* is_csrss_connected) { | 94 void HandleCloserAgent::InitializeHandlesToClose(bool* is_csrss_connected) { |
| 96 CHECK(g_handles_to_close != NULL); | 95 CHECK(g_handles_to_close != NULL); |
| 97 | 96 |
| 98 // Default to connected state | 97 // Default to connected state |
| 99 *is_csrss_connected = true; | 98 *is_csrss_connected = true; |
| 100 | 99 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 return false; | 193 return false; |
| 195 // Attempt to stuff this handle with a new dummy Event. | 194 // Attempt to stuff this handle with a new dummy Event. |
| 196 AttemptToStuffHandleSlot(handle, result->first); | 195 AttemptToStuffHandleSlot(handle, result->first); |
| 197 } | 196 } |
| 198 } | 197 } |
| 199 | 198 |
| 200 return true; | 199 return true; |
| 201 } | 200 } |
| 202 | 201 |
| 203 } // namespace sandbox | 202 } // namespace sandbox |
| OLD | NEW |