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

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

Issue 717223002: Browser watcher end-end-to-end . (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/lkgr
Patch Set: Address Erik's comments. Created 6 years, 1 month 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 | « components/browser_watcher/OWNERS ('k') | components/browser_watcher/watcher_client_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_BROWSER_WATCHER_WATCHER_CLIENT_WIN_H_
6 #define COMPONENTS_BROWSER_WATCHER_WATCHER_CLIENT_WIN_H_
7
8 #include "base/command_line.h"
9 #include "base/macros.h"
10 #include "base/process/process_handle.h"
11 #include "base/win/scoped_handle.h"
12
13 namespace browser_watcher {
14
15 // An interface class to take care of the details in launching a browser
16 // watch process.
17 class WatcherClient {
18 public:
19 // Constructs a watcher client with a |base_command_line|, which should be
20 // a command line sufficient to invoke the watcher process. This command
21 // line will be augmented with the value of the inherited handle.
22 explicit WatcherClient(const base::CommandLine& base_command_line);
23
24 // Launches the watcher process.
25 void LaunchWatcher();
26
27 // Accessors, exposed only for testing.
28 bool use_legacy_launch() const { return use_legacy_launch_; }
29 void set_use_legacy_launch(bool use_legacy_launch) {
30 use_legacy_launch_ = use_legacy_launch;
31 }
32 base::ProcessHandle process() const { return process_.Get(); }
33
34 private:
35 // Launches |cmd_line| such that the child process is able to inherit
36 // |handle|. If |use_legacy_launch_| is true, this uses a non-threadsafe
37 // legacy launch mode that's compatible with Windows XP.
38 // Returns a handle to the child process.
39 base::win::ScopedHandle LaunchWatcherProcess(
40 const base::CommandLine& cmd_line, base::ProcessHandle self_handle);
41
42 // If true, the watcher process will be launched with XP legacy handle
43 // inheritance. This is not thread safe and can leak random handles into the
44 // child process, but it's the best we can do on XP.
45 bool use_legacy_launch_;
46
47 // The base command line passed to the constructor.
48 base::CommandLine base_command_line_;
49
50 // A handle to the launched watcher process. Valid after a successful
51 // LaunchWatcher() call.
52 base::win::ScopedHandle process_;
53
54 DISALLOW_COPY_AND_ASSIGN(WatcherClient);
55 };
56
57 } // namespace browser_watcher
58
59 #endif // COMPONENTS_BROWSER_WATCHER_WATCHER_CLIENT_WIN_H_
OLDNEW
« no previous file with comments | « components/browser_watcher/OWNERS ('k') | components/browser_watcher/watcher_client_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698