| 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 #ifndef SANDBOX_SRC_HANDLE_CLOSER_H_ | 5 #ifndef SANDBOX_SRC_HANDLE_CLOSER_H_ |
| 6 #define SANDBOX_SRC_HANDLE_CLOSER_H_ | 6 #define SANDBOX_SRC_HANDLE_CLOSER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 size_t num_handle_types; | 35 size_t num_handle_types; |
| 36 struct HandleListEntry handle_entries[1]; | 36 struct HandleListEntry handle_entries[1]; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 SANDBOX_INTERCEPT HandleCloserInfo* g_handle_closer_info; | 39 SANDBOX_INTERCEPT HandleCloserInfo* g_handle_closer_info; |
| 40 | 40 |
| 41 // Adds handles to close after lockdown. | 41 // Adds handles to close after lockdown. |
| 42 class HandleCloser { | 42 class HandleCloser { |
| 43 public: | 43 public: |
| 44 HandleCloser(); | 44 HandleCloser(); |
| 45 ~HandleCloser(); |
| 45 | 46 |
| 46 // Adds a handle that will be closed in the target process after lockdown. | 47 // Adds a handle that will be closed in the target process after lockdown. |
| 47 // A NULL value for handle_name indicates all handles of the specified type. | 48 // A NULL value for handle_name indicates all handles of the specified type. |
| 48 // An empty string for handle_name indicates the handle is unnamed. | 49 // An empty string for handle_name indicates the handle is unnamed. |
| 49 ResultCode AddHandle(const base::char16* handle_type, | 50 ResultCode AddHandle(const base::char16* handle_type, |
| 50 const base::char16* handle_name); | 51 const base::char16* handle_name); |
| 51 | 52 |
| 52 // Serializes and copies the closer table into the target process. | 53 // Serializes and copies the closer table into the target process. |
| 53 bool InitializeTargetHandles(TargetProcess* target); | 54 bool InitializeTargetHandles(TargetProcess* target); |
| 54 | 55 |
| 55 private: | 56 private: |
| 56 // Calculates the memory needed to copy the serialized handles list (rounded | 57 // Calculates the memory needed to copy the serialized handles list (rounded |
| 57 // to the nearest machine-word size). | 58 // to the nearest machine-word size). |
| 58 size_t GetBufferSize(); | 59 size_t GetBufferSize(); |
| 59 | 60 |
| 60 // Serializes the handle list into the target process. | 61 // Serializes the handle list into the target process. |
| 61 bool SetupHandleList(void* buffer, size_t buffer_bytes); | 62 bool SetupHandleList(void* buffer, size_t buffer_bytes); |
| 62 | 63 |
| 63 HandleMap handles_to_close_; | 64 HandleMap handles_to_close_; |
| 64 | 65 |
| 65 DISALLOW_COPY_AND_ASSIGN(HandleCloser); | 66 DISALLOW_COPY_AND_ASSIGN(HandleCloser); |
| 66 }; | 67 }; |
| 67 | 68 |
| 68 // Returns the object manager's name associated with a handle | 69 // Returns the object manager's name associated with a handle |
| 69 bool GetHandleName(HANDLE handle, base::string16* handle_name); | 70 bool GetHandleName(HANDLE handle, base::string16* handle_name); |
| 70 | 71 |
| 71 } // namespace sandbox | 72 } // namespace sandbox |
| 72 | 73 |
| 73 #endif // SANDBOX_SRC_HANDLE_CLOSER_H_ | 74 #endif // SANDBOX_SRC_HANDLE_CLOSER_H_ |
| OLD | NEW |