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

Side by Side Diff: content/browser/child_process_launcher.cc

Issue 2706933003: webapk: Avoid overwriting default CreationParams
Patch Set: rebase 461342 Created 3 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "content/browser/child_process_launcher.h" 5 #include "content/browser/child_process_launcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/i18n/icu_util.h" 10 #include "base/i18n/icu_util.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/process/launch.h" 12 #include "base/process/launch.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "content/public/common/result_codes.h" 14 #include "content/public/common/result_codes.h"
15 #include "content/public/common/sandboxed_process_launcher_delegate.h" 15 #include "content/public/common/sandboxed_process_launcher_delegate.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 using internal::ChildProcessLauncherHelper; 19 using internal::ChildProcessLauncherHelper;
20 20
21 ChildProcessLauncher::ChildProcessLauncher( 21 ChildProcessLauncher::ChildProcessLauncher(
22 std::unique_ptr<SandboxedProcessLauncherDelegate> delegate, 22 std::unique_ptr<SandboxedProcessLauncherDelegate> delegate,
23 std::unique_ptr<base::CommandLine> command_line, 23 std::unique_ptr<base::CommandLine> command_line,
24 int child_process_id, 24 int child_process_id,
25 Client* client, 25 Client* client,
26 std::unique_ptr<mojo::edk::PendingProcessConnection> pending_connection, 26 std::unique_ptr<mojo::edk::PendingProcessConnection> pending_connection,
27 const mojo::edk::ProcessErrorCallback& process_error_callback, 27 const mojo::edk::ProcessErrorCallback& process_error_callback,
28 bool terminate_on_shutdown) 28 bool terminate_on_shutdown,
29 int param_id)
29 : client_(client), 30 : client_(client),
30 termination_status_(base::TERMINATION_STATUS_NORMAL_TERMINATION), 31 termination_status_(base::TERMINATION_STATUS_NORMAL_TERMINATION),
31 exit_code_(RESULT_CODE_NORMAL_EXIT), 32 exit_code_(RESULT_CODE_NORMAL_EXIT),
32 starting_(true), 33 starting_(true),
33 pending_connection_(std::move(pending_connection)), 34 pending_connection_(std::move(pending_connection)),
34 process_error_callback_(process_error_callback), 35 process_error_callback_(process_error_callback),
35 #if defined(ADDRESS_SANITIZER) || defined(LEAK_SANITIZER) || \ 36 #if defined(ADDRESS_SANITIZER) || defined(LEAK_SANITIZER) || \
36 defined(MEMORY_SANITIZER) || defined(THREAD_SANITIZER) || \ 37 defined(MEMORY_SANITIZER) || defined(THREAD_SANITIZER) || \
37 defined(UNDEFINED_SANITIZER) 38 defined(UNDEFINED_SANITIZER)
38 terminate_child_on_shutdown_(false), 39 terminate_child_on_shutdown_(false),
39 #else 40 #else
40 terminate_child_on_shutdown_(terminate_on_shutdown), 41 terminate_child_on_shutdown_(terminate_on_shutdown),
41 #endif 42 #endif
42 weak_factory_(this) { 43 weak_factory_(this) {
43 DCHECK(CalledOnValidThread()); 44 DCHECK(CalledOnValidThread());
44 CHECK(BrowserThread::GetCurrentThreadIdentifier(&client_thread_id_)); 45 CHECK(BrowserThread::GetCurrentThreadIdentifier(&client_thread_id_));
45 46
46 helper_ = new ChildProcessLauncherHelper( 47 helper_ = new ChildProcessLauncherHelper(
47 child_process_id, client_thread_id_, 48 child_process_id, client_thread_id_, std::move(command_line),
48 std::move(command_line), std::move(delegate), 49 std::move(delegate), weak_factory_.GetWeakPtr(), terminate_on_shutdown,
49 weak_factory_.GetWeakPtr(), terminate_on_shutdown); 50 param_id);
50 helper_->StartLaunchOnClientThread(); 51 helper_->StartLaunchOnClientThread();
51 } 52 }
52 53
53 ChildProcessLauncher::~ChildProcessLauncher() { 54 ChildProcessLauncher::~ChildProcessLauncher() {
54 DCHECK(CalledOnValidThread()); 55 DCHECK(CalledOnValidThread());
55 if (process_.process.IsValid() && terminate_child_on_shutdown_) { 56 if (process_.process.IsValid() && terminate_child_on_shutdown_) {
56 // Client has gone away, so just kill the process. 57 // Client has gone away, so just kill the process.
57 ChildProcessLauncherHelper::ForceNormalProcessTerminationAsync( 58 ChildProcessLauncherHelper::ForceNormalProcessTerminationAsync(
58 std::move(process_)); 59 std::move(process_));
59 } 60 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 } 165 }
165 166
166 ChildProcessLauncher::Client* ChildProcessLauncher::ReplaceClientForTest( 167 ChildProcessLauncher::Client* ChildProcessLauncher::ReplaceClientForTest(
167 Client* client) { 168 Client* client) {
168 Client* ret = client_; 169 Client* ret = client_;
169 client_ = client; 170 client_ = client;
170 return ret; 171 return ret;
171 } 172 }
172 173
173 } // namespace content 174 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/child_process_launcher.h ('k') | content/browser/child_process_launcher_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698