Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Side by Side Diff: sandbox/win/src/broker_services.h

Issue 1228373003: Sandbox: Remove ::CloseHandle from BrokerServices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename and improve comments. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | sandbox/win/src/broker_services.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_WIN_SRC_BROKER_SERVICES_H_ 5 #ifndef SANDBOX_WIN_SRC_BROKER_SERVICES_H_
6 #define SANDBOX_WIN_SRC_BROKER_SERVICES_H_ 6 #define SANDBOX_WIN_SRC_BROKER_SERVICES_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 const wchar_t* name) override; 57 const wchar_t* name) override;
58 ResultCode UninstallAppContainer(const wchar_t* sid) override; 58 ResultCode UninstallAppContainer(const wchar_t* sid) override;
59 59
60 // Checks if the supplied process ID matches one of the broker's active 60 // Checks if the supplied process ID matches one of the broker's active
61 // target processes 61 // target processes
62 // Returns: 62 // Returns:
63 // true if there is an active target process for this ID, otherwise false. 63 // true if there is an active target process for this ID, otherwise false.
64 bool IsActiveTarget(DWORD process_id); 64 bool IsActiveTarget(DWORD process_id);
65 65
66 private: 66 private:
67 // Releases the Job and notifies the associated Policy object to its 67 struct TokenPair;
68 // resources as well. 68 typedef std::list<JobTracker*> JobTrackerList;
69 static void FreeResources(JobTracker* tracker); 69 typedef std::map<DWORD, PeerTracker*> PeerTrackerMap;
70 typedef std::map<uint32_t, TokenPair*> TokenCacheMap;
70 71
71 // The routine that the worker thread executes. It is in charge of 72 // The routine that the worker thread executes. It is in charge of
72 // notifications and cleanup-related tasks. 73 // notifications and cleanup-related tasks.
73 static DWORD WINAPI TargetEventsThread(PVOID param); 74 static DWORD WINAPI TargetEventsThread(PVOID param);
74 75
75 // Removes a target peer from the process list if it expires. 76 // Removes a target peer from the process list if it expires.
76 static VOID CALLBACK RemovePeer(PVOID parameter, BOOLEAN timeout); 77 static VOID CALLBACK RemovePeer(PVOID parameter, BOOLEAN timeout);
77 78
78 // The completion port used by the job objects to communicate events to 79 // The completion port used by the job objects to communicate events to
79 // the worker thread. 80 // the worker thread.
80 HANDLE job_port_; 81 base::win::ScopedHandle job_port_;
81 82
82 // Handle to a manual-reset event that is signaled when the total target 83 // Handle to a manual-reset event that is signaled when the total target
83 // process count reaches zero. 84 // process count reaches zero.
84 HANDLE no_targets_; 85 base::win::ScopedHandle no_targets_;
85 86
86 // Handle to the worker thread that reacts to job notifications. 87 // Handle to the worker thread that reacts to job notifications.
87 HANDLE job_thread_; 88 base::win::ScopedHandle job_thread_;
88 89
89 // Lock used to protect the list of targets from being modified by 2 90 // Lock used to protect the list of targets from being modified by 2
90 // threads at the same time. 91 // threads at the same time.
91 CRITICAL_SECTION lock_; 92 CRITICAL_SECTION lock_;
92 93
93 // provides a pool of threads that are used to wait on the IPC calls. 94 // provides a pool of threads that are used to wait on the IPC calls.
94 ThreadProvider* thread_pool_; 95 ThreadProvider* thread_pool_;
95 96
96 // List of the trackers for closing and cleanup purposes. 97 // List of the trackers for closing and cleanup purposes.
97 typedef std::list<JobTracker*> JobTrackerList;
98 JobTrackerList tracker_list_; 98 JobTrackerList tracker_list_;
99 99
100 // Maps peer process IDs to the saved handle and wait event. 100 // Maps peer process IDs to the saved handle and wait event.
101 // Prevents peer callbacks from accessing the broker after destruction. 101 // Prevents peer callbacks from accessing the broker after destruction.
102 typedef std::map<DWORD, PeerTracker*> PeerTrackerMap;
103 PeerTrackerMap peer_map_; 102 PeerTrackerMap peer_map_;
104 103
105 // Provides a fast lookup to identify sandboxed processes that belong to a 104 // Provides a fast lookup to identify sandboxed processes that belong to a
106 // job. Consult |jobless_process_handles_| for handles of pocess without job. 105 // job. Consult |jobless_process_handles_| for handles of pocess without job.
107 std::set<DWORD> child_process_ids_; 106 std::set<DWORD> child_process_ids_;
108 107
109 typedef std::map<uint32_t, std::pair<HANDLE, HANDLE>> TokenCacheMap;
110 TokenCacheMap token_cache_; 108 TokenCacheMap token_cache_;
111 109
112 DISALLOW_COPY_AND_ASSIGN(BrokerServicesBase); 110 DISALLOW_COPY_AND_ASSIGN(BrokerServicesBase);
113 }; 111 };
114 112
115 } // namespace sandbox 113 } // namespace sandbox
116 114
117 115
118 #endif // SANDBOX_WIN_SRC_BROKER_SERVICES_H_ 116 #endif // SANDBOX_WIN_SRC_BROKER_SERVICES_H_
OLDNEW
« no previous file with comments | « no previous file | sandbox/win/src/broker_services.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698