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

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: Move to components 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
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/files/file_path.h"
erikwright (departed) 2014/11/14 19:46:09 not used
Sigurður Ásgeirsson 2014/11/17 15:26:58 Done.
10 #include "base/macros.h"
11 #include "base/process/process_handle.h"
12 #include "base/win/scoped_handle.h"
13
14 namespace browser_watcher {
15
16 // An interface class to take care of the details in launching a browser
17 // watch process.
18 class WatcherClient {
19 public:
20 // Constructs a watcher client with a |base_command_line|, which should be
21 // a command line sufficient to invoke the watcher process. This command
22 // line will be augmented with the value of the inherited handle.
23 explicit WatcherClient(const base::CommandLine& base_command_line);
24
25 // Launches the watcher process.
26 void LaunchWatcher();
27
28 // Accessors, exposed only for testing.
29 bool use_legacy_launch() const { return use_legacy_launch_; }
30 void set_use_legacy_launch(bool use_legacy_launch) {
31 use_legacy_launch_ = use_legacy_launch;
32 }
33 base::ProcessHandle process() const { return process_.Get(); }
34
35 private:
36 // Launches |cmd_line| such that the child process is able to inherit
37 // |handle|. If |use_legacy_launch_| is true, this uses a non-threadsafe
38 // legacy launch mode that's compatible with Windows XP.
39 // Returns a handle to the child process.
40 base::win::ScopedHandle LaunchWatcherProcess(
41 const base::CommandLine& cmd_line, base::ProcessHandle self_handle);
42
43 // If true, the watcher process will be launched with XP legacy handle
44 // inheritance. This is not thread safe and can leak random handles into the
45 // child process, but it's the best we can do on XP.
46 bool use_legacy_launch_;
47
48 // The base command line passed to the constructor.
49 base::CommandLine base_command_line_;
50
51 // A handle to the launched watcher process. Valid after a successful
52 // LaunchWatcher() call.
53 base::win::ScopedHandle process_;
54
55 DISALLOW_COPY_AND_ASSIGN(WatcherClient);
56 };
57
58 } // namespace browser_watcher
59
60 #endif // COMPONENTS_BROWSER_WATCHER_WATCHER_CLIENT_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698