OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 SANDBOX_SRC_HANDLE_TABLE_H_ | 5 #ifndef SANDBOX_SRC_HANDLE_TABLE_H_ |
6 #define SANDBOX_SRC_HANDLE_TABLE_H_ | 6 #define SANDBOX_SRC_HANDLE_TABLE_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 static const base::char16* HandleTable::kTypeNamedPipe; | 33 static const base::char16* HandleTable::kTypeNamedPipe; |
34 static const base::char16* HandleTable::kTypeJobObject; | 34 static const base::char16* HandleTable::kTypeJobObject; |
35 static const base::char16* HandleTable::kTypeFileMap; | 35 static const base::char16* HandleTable::kTypeFileMap; |
36 static const base::char16* HandleTable::kTypeAlpcPort; | 36 static const base::char16* HandleTable::kTypeAlpcPort; |
37 | 37 |
38 class Iterator; | 38 class Iterator; |
39 | 39 |
40 // Used by the iterator to provide simple caching accessors to handle data. | 40 // Used by the iterator to provide simple caching accessors to handle data. |
41 class HandleEntry { | 41 class HandleEntry { |
42 public: | 42 public: |
| 43 ~HandleEntry(); |
| 44 |
43 bool operator==(const HandleEntry& rhs) const { | 45 bool operator==(const HandleEntry& rhs) const { |
44 return handle_entry_ == rhs.handle_entry_; | 46 return handle_entry_ == rhs.handle_entry_; |
45 } | 47 } |
46 | 48 |
47 bool operator!=(const HandleEntry& rhs) const { | 49 bool operator!=(const HandleEntry& rhs) const { |
48 return handle_entry_ != rhs.handle_entry_; | 50 return handle_entry_ != rhs.handle_entry_; |
49 } | 51 } |
50 | 52 |
51 const SYSTEM_HANDLE_INFORMATION* handle_entry() const { | 53 const SYSTEM_HANDLE_INFORMATION* handle_entry() const { |
52 return handle_entry_; | 54 return handle_entry_; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 121 |
120 HandleEntry* operator->() { return ¤t_; } | 122 HandleEntry* operator->() { return ¤t_; } |
121 | 123 |
122 private: | 124 private: |
123 const HandleTable& table_; | 125 const HandleTable& table_; |
124 HandleEntry current_; | 126 HandleEntry current_; |
125 const SYSTEM_HANDLE_INFORMATION* end_; | 127 const SYSTEM_HANDLE_INFORMATION* end_; |
126 }; | 128 }; |
127 | 129 |
128 HandleTable(); | 130 HandleTable(); |
| 131 ~HandleTable(); |
129 | 132 |
130 Iterator begin() const { | 133 Iterator begin() const { |
131 return Iterator(*this, handle_info()->Information, | 134 return Iterator(*this, handle_info()->Information, |
132 &handle_info()->Information[handle_info()->NumberOfHandles]); | 135 &handle_info()->Information[handle_info()->NumberOfHandles]); |
133 } | 136 } |
134 | 137 |
135 const SYSTEM_HANDLE_INFORMATION_EX* handle_info() const { | 138 const SYSTEM_HANDLE_INFORMATION_EX* handle_info() const { |
136 return reinterpret_cast<const SYSTEM_HANDLE_INFORMATION_EX*>( | 139 return reinterpret_cast<const SYSTEM_HANDLE_INFORMATION_EX*>( |
137 &(handle_info_buffer_[0])); | 140 &(handle_info_buffer_[0])); |
138 } | 141 } |
(...skipping 11 matching lines...) Expand all Loading... |
150 } | 153 } |
151 | 154 |
152 std::vector<BYTE> handle_info_buffer_; | 155 std::vector<BYTE> handle_info_buffer_; |
153 | 156 |
154 DISALLOW_COPY_AND_ASSIGN(HandleTable); | 157 DISALLOW_COPY_AND_ASSIGN(HandleTable); |
155 }; | 158 }; |
156 | 159 |
157 } // namespace sandbox | 160 } // namespace sandbox |
158 | 161 |
159 #endif // SANDBOX_SRC_HANDLE_TABLE_H_ | 162 #endif // SANDBOX_SRC_HANDLE_TABLE_H_ |
OLD | NEW |