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

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

Issue 9924010: Revert 129627 - Add a sandbox API for broker handle duplication (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « sandbox/sandbox.gyp ('k') | sandbox/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) 2010 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_BROKER_SERVICES_H__ 5 #ifndef SANDBOX_SRC_BROKER_SERVICES_H__
6 #define SANDBOX_SRC_BROKER_SERVICES_H__ 6 #define SANDBOX_SRC_BROKER_SERVICES_H__
7 7
8 #include <list> 8 #include <list>
9 #include <set>
10 #include "base/basictypes.h" 9 #include "base/basictypes.h"
11 #include "sandbox/src/crosscall_server.h" 10 #include "sandbox/src/crosscall_server.h"
12 #include "sandbox/src/job.h" 11 #include "sandbox/src/job.h"
13 #include "sandbox/src/sandbox.h" 12 #include "sandbox/src/sandbox.h"
14 #include "sandbox/src/sharedmem_ipc_server.h" 13 #include "sandbox/src/sharedmem_ipc_server.h"
15 #include "sandbox/src/win2k_threadpool.h" 14 #include "sandbox/src/win2k_threadpool.h"
16 #include "sandbox/src/win_utils.h" 15 #include "sandbox/src/win_utils.h"
17 16
18 namespace sandbox { 17 namespace sandbox {
19 18
20 class PolicyBase; 19 class PolicyBase;
21 20
22 // BrokerServicesBase --------------------------------------------------------- 21 // BrokerServicesBase ---------------------------------------------------------
23 // Broker implementation version 0 22 // Broker implementation version 0
24 // 23 //
25 // This is an implementation of the interface BrokerServices and 24 // This is an implementation of the interface BrokerServices and
26 // of the associated TargetProcess interface. In this implementation 25 // of the associated TargetProcess interface. In this implementation
27 // TargetProcess is a friend of BrokerServices where the later manages a 26 // TargetProcess is a friend of BrokerServices where the later manages a
28 // collection of the former. 27 // collection of the former.
29 class BrokerServicesBase : public BrokerServices, 28 class BrokerServicesBase : public BrokerServices,
30 public SingletonBase<BrokerServicesBase> { 29 public SingletonBase<BrokerServicesBase> {
31 public: 30 public:
32 BrokerServicesBase(); 31 BrokerServicesBase();
33 32
34 ~BrokerServicesBase(); 33 ~BrokerServicesBase();
35 34
36 // The next five methods are the BrokerServices interface 35 // The next four methods are the BrokerServices interface
37 virtual ResultCode Init(); 36 virtual ResultCode Init();
38 37
39 virtual TargetPolicy* CreatePolicy(); 38 virtual TargetPolicy* CreatePolicy();
40 39
41 virtual ResultCode SpawnTarget(const wchar_t* exe_path, 40 virtual ResultCode SpawnTarget(const wchar_t* exe_path,
42 const wchar_t* command_line, 41 const wchar_t* command_line,
43 TargetPolicy* policy, 42 TargetPolicy* policy,
44 PROCESS_INFORMATION* target); 43 PROCESS_INFORMATION* target);
45 44
46 virtual ResultCode WaitForAllTargets(); 45 virtual ResultCode WaitForAllTargets();
47 46
48 // Checks if the supplied process ID matches one of the broker's active
49 // target processes
50 // Returns:
51 // true if there is an active target process for this ID, otherwise false.
52 bool IsActiveTarget(DWORD process_id);
53
54 private: 47 private:
55 // Helper structure that allows the Broker to associate a job notification 48 // Helper structure that allows the Broker to associate a job notification
56 // with a job object and with a policy. 49 // with a job object and with a policy.
57 struct JobTracker { 50 struct JobTracker {
58 HANDLE job; 51 HANDLE job;
59 PolicyBase* policy; 52 PolicyBase* policy;
60 JobTracker(HANDLE cjob, PolicyBase* cpolicy) 53 JobTracker(HANDLE cjob, PolicyBase* cpolicy)
61 : job(cjob), policy(cpolicy) { 54 : job(cjob), policy(cpolicy) {
62 } 55 }
63 }; 56 };
(...skipping 21 matching lines...) Expand all
85 // threads at the same time. 78 // threads at the same time.
86 CRITICAL_SECTION lock_; 79 CRITICAL_SECTION lock_;
87 80
88 // provides a pool of threads that are used to wait on the IPC calls. 81 // provides a pool of threads that are used to wait on the IPC calls.
89 ThreadProvider* thread_pool_; 82 ThreadProvider* thread_pool_;
90 83
91 // List of the trackers for closing and cleanup purposes. 84 // List of the trackers for closing and cleanup purposes.
92 typedef std::list<JobTracker*> JobTrackerList; 85 typedef std::list<JobTracker*> JobTrackerList;
93 JobTrackerList tracker_list_; 86 JobTrackerList tracker_list_;
94 87
95 // Provides a fast lookup to identify sandboxed processes.
96 std::set<DWORD> child_process_ids_;
97
98 DISALLOW_COPY_AND_ASSIGN(BrokerServicesBase); 88 DISALLOW_COPY_AND_ASSIGN(BrokerServicesBase);
99 }; 89 };
100 90
101 } // namespace sandbox 91 } // namespace sandbox
102 92
103 93
104 #endif // SANDBOX_SRC_BROKER_SERVICES_H__ 94 #endif // SANDBOX_SRC_BROKER_SERVICES_H__
OLDNEW
« no previous file with comments | « sandbox/sandbox.gyp ('k') | sandbox/src/broker_services.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698