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

Side by Side Diff: remoting/host/win/worker_process_launcher.h

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 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
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 REMOTING_HOST_WIN_WORKER_PROCESS_LAUNCHER_H_ 5 #ifndef REMOTING_HOST_WIN_WORKER_PROCESS_LAUNCHER_H_
6 #define REMOTING_HOST_WIN_WORKER_PROCESS_LAUNCHER_H_ 6 #define REMOTING_HOST_WIN_WORKER_PROCESS_LAUNCHER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory>
11
10 #include "base/callback.h" 12 #include "base/callback.h"
11 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
12 #include "base/macros.h" 14 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/threading/non_thread_safe.h" 16 #include "base/threading/non_thread_safe.h"
16 #include "base/timer/timer.h" 17 #include "base/timer/timer.h"
17 #include "base/win/object_watcher.h" 18 #include "base/win/object_watcher.h"
18 #include "base/win/scoped_handle.h" 19 #include "base/win/scoped_handle.h"
19 #include "net/base/backoff_entry.h" 20 #include "net/base/backoff_entry.h"
20 21
21 namespace base { 22 namespace base {
22 class SingleThreadTaskRunner; 23 class SingleThreadTaskRunner;
23 class TimeDelta; 24 class TimeDelta;
24 } // namespace base 25 } // namespace base
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // Closes the IPC channel. 60 // Closes the IPC channel.
60 virtual void CloseChannel() = 0; 61 virtual void CloseChannel() = 0;
61 62
62 // Terminates the worker process and closes the IPC channel. 63 // Terminates the worker process and closes the IPC channel.
63 virtual void KillProcess() = 0; 64 virtual void KillProcess() = 0;
64 }; 65 };
65 66
66 // Creates the launcher that will use |launcher_delegate| to manage the worker 67 // Creates the launcher that will use |launcher_delegate| to manage the worker
67 // process and |ipc_handler| to handle IPCs. The caller must ensure that 68 // process and |ipc_handler| to handle IPCs. The caller must ensure that
68 // |ipc_handler| must outlive this object. 69 // |ipc_handler| must outlive this object.
69 WorkerProcessLauncher(scoped_ptr<Delegate> launcher_delegate, 70 WorkerProcessLauncher(std::unique_ptr<Delegate> launcher_delegate,
70 WorkerProcessIpcDelegate* ipc_handler); 71 WorkerProcessIpcDelegate* ipc_handler);
71 ~WorkerProcessLauncher() override; 72 ~WorkerProcessLauncher() override;
72 73
73 // Asks the worker process to crash and generate a dump, and closes the IPC 74 // Asks the worker process to crash and generate a dump, and closes the IPC
74 // channel. |location| is passed to the worker so that it is on the stack in 75 // channel. |location| is passed to the worker so that it is on the stack in
75 // the dump. Restarts the worker process forcefully, if it does 76 // the dump. Restarts the worker process forcefully, if it does
76 // not exit on its own. 77 // not exit on its own.
77 void Crash(const tracked_objects::Location& location); 78 void Crash(const tracked_objects::Location& location);
78 79
79 // Sends an IPC message to the worker process. The message will be silently 80 // Sends an IPC message to the worker process. The message will be silently
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 void SetKillProcessTimeoutForTest(const base::TimeDelta& timeout); 124 void SetKillProcessTimeoutForTest(const base::TimeDelta& timeout);
124 125
125 // Stops the worker process and schedules next launch attempt unless the 126 // Stops the worker process and schedules next launch attempt unless the
126 // object is being destroyed already. 127 // object is being destroyed already.
127 void StopWorker(); 128 void StopWorker();
128 129
129 // Handles IPC messages sent by the worker process. 130 // Handles IPC messages sent by the worker process.
130 WorkerProcessIpcDelegate* ipc_handler_; 131 WorkerProcessIpcDelegate* ipc_handler_;
131 132
132 // Implements specifics of launching a worker process. 133 // Implements specifics of launching a worker process.
133 scoped_ptr<WorkerProcessLauncher::Delegate> launcher_delegate_; 134 std::unique_ptr<WorkerProcessLauncher::Delegate> launcher_delegate_;
134 135
135 // Keeps the exit code of the worker process after it was closed. The exit 136 // Keeps the exit code of the worker process after it was closed. The exit
136 // code is used to determine whether the process has to be restarted. 137 // code is used to determine whether the process has to be restarted.
137 DWORD exit_code_; 138 DWORD exit_code_;
138 139
139 // True if IPC messages should be passed to |ipc_handler_|. 140 // True if IPC messages should be passed to |ipc_handler_|.
140 bool ipc_enabled_; 141 bool ipc_enabled_;
141 142
142 // The timer used to delay termination of the worker process when an IPC error 143 // The timer used to delay termination of the worker process when an IPC error
143 // occured or when Crash() request is pending 144 // occured or when Crash() request is pending
(...skipping 18 matching lines...) Expand all
162 163
163 // The handle of the worker process, if launched. 164 // The handle of the worker process, if launched.
164 base::win::ScopedHandle worker_process_; 165 base::win::ScopedHandle worker_process_;
165 166
166 DISALLOW_COPY_AND_ASSIGN(WorkerProcessLauncher); 167 DISALLOW_COPY_AND_ASSIGN(WorkerProcessLauncher);
167 }; 168 };
168 169
169 } // namespace remoting 170 } // namespace remoting
170 171
171 #endif // REMOTING_HOST_WIN_WORKER_PROCESS_LAUNCHER_H_ 172 #endif // REMOTING_HOST_WIN_WORKER_PROCESS_LAUNCHER_H_
OLDNEW
« no previous file with comments | « remoting/host/win/unprivileged_process_delegate.cc ('k') | remoting/host/win/worker_process_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698