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

Side by Side Diff: components/browser_watcher/watcher_client_win.h

Issue 2950153002: Improve process launch handle sharing API. (Closed)
Patch Set: Fix Created 3 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
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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 COMPONENTS_BROWSER_WATCHER_WATCHER_CLIENT_WIN_H_ 5 #ifndef COMPONENTS_BROWSER_WATCHER_WATCHER_CLIENT_WIN_H_
6 #define COMPONENTS_BROWSER_WATCHER_WATCHER_CLIENT_WIN_H_ 6 #define COMPONENTS_BROWSER_WATCHER_WATCHER_CLIENT_WIN_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/process/process.h" 10 #include "base/process/process.h"
(...skipping 24 matching lines...) Expand all
35 void LaunchWatcher(); 35 void LaunchWatcher();
36 36
37 // Ensures that |handle| may be inherited by the watcher process. |handle| 37 // Ensures that |handle| may be inherited by the watcher process. |handle|
38 // must still be inheritable, and it's the client's responsibility to 38 // must still be inheritable, and it's the client's responsibility to
39 // communicate the value of |handle| to the launched process. 39 // communicate the value of |handle| to the launched process.
40 void AddInheritedHandle(HANDLE handle); 40 void AddInheritedHandle(HANDLE handle);
41 41
42 // Returns the launched process. 42 // Returns the launched process.
43 const base::Process& process() const { return process_; } 43 const base::Process& process() const { return process_; }
44 44
45 // Accessors, exposed only for testing.
46 bool use_legacy_launch() const { return use_legacy_launch_; }
47 void set_use_legacy_launch(bool use_legacy_launch) {
48 use_legacy_launch_ = use_legacy_launch;
49 }
50
51 private: 45 private:
52 // If true, the watcher process will be launched with XP legacy handle
53 // inheritance. This is not thread safe and can leak random handles into the
54 // child process, but it's the best we can do on XP.
55 bool use_legacy_launch_;
56
57 // The CommandLineGenerator passed to the constructor. 46 // The CommandLineGenerator passed to the constructor.
58 CommandLineGenerator command_line_generator_; 47 CommandLineGenerator command_line_generator_;
59 48
60 // A handle to the launched watcher process. Valid after a successful 49 // A handle to the launched watcher process. Valid after a successful
61 // LaunchWatcher() call. 50 // LaunchWatcher() call.
62 base::Process process_; 51 base::Process process_;
63 52
64 std::vector<HANDLE> inherited_handles_; 53 std::vector<HANDLE> inherited_handles_;
65 54
66 DISALLOW_COPY_AND_ASSIGN(WatcherClient); 55 DISALLOW_COPY_AND_ASSIGN(WatcherClient);
67 }; 56 };
68 57
69 } // namespace browser_watcher 58 } // namespace browser_watcher
70 59
71 #endif // COMPONENTS_BROWSER_WATCHER_WATCHER_CLIENT_WIN_H_ 60 #endif // COMPONENTS_BROWSER_WATCHER_WATCHER_CLIENT_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698