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

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

Issue 2821583002: android: Post stop/onServiceDisconnected to launcher (Closed)
Patch Set: rebase 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
« no previous file with comments | « no previous file | content/public/android/java/src/org/chromium/content/browser/ChildConnectionAllocator.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_helper_android.h" 5 #include "content/browser/child_process_launcher_helper_android.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/android/apk_assets.h" 9 #include "base/android/apk_assets.h"
10 #include "base/android/context_utils.h" 10 #include "base/android/context_utils.h"
(...skipping 16 matching lines...) Expand all
27 using base::android::ScopedJavaGlobalRef; 27 using base::android::ScopedJavaGlobalRef;
28 using base::android::ScopedJavaLocalRef; 28 using base::android::ScopedJavaLocalRef;
29 using base::android::ToJavaArrayOfStrings; 29 using base::android::ToJavaArrayOfStrings;
30 30
31 namespace content { 31 namespace content {
32 namespace internal { 32 namespace internal {
33 namespace { 33 namespace {
34 34
35 // Stops a child process based on the handle returned from StartChildProcess. 35 // Stops a child process based on the handle returned from StartChildProcess.
36 void StopChildProcess(base::ProcessHandle handle) { 36 void StopChildProcess(base::ProcessHandle handle) {
37 DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER);
37 JNIEnv* env = AttachCurrentThread(); 38 JNIEnv* env = AttachCurrentThread();
38 DCHECK(env); 39 DCHECK(env);
39 Java_ChildProcessLauncherHelper_stop(env, static_cast<jint>(handle)); 40 Java_ChildProcessLauncherHelper_stop(env, static_cast<jint>(handle));
40 } 41 }
41 42
42 } // namespace 43 } // namespace
43 44
44 void ChildProcessLauncherHelper::BeforeLaunchOnClientThread() { 45 void ChildProcessLauncherHelper::BeforeLaunchOnClientThread() {
45 // Android only supports renderer, sandboxed utility and gpu. 46 // Android only supports renderer, sandboxed utility and gpu.
46 std::string process_type = 47 std::string process_type =
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 if (Java_ChildProcessLauncherHelper_isOomProtected(AttachCurrentThread(), 153 if (Java_ChildProcessLauncherHelper_isOomProtected(AttachCurrentThread(),
153 java_peer_)) { 154 java_peer_)) {
154 return base::TERMINATION_STATUS_OOM_PROTECTED; 155 return base::TERMINATION_STATUS_OOM_PROTECTED;
155 } 156 }
156 return base::GetTerminationStatus(process.process.Handle(), exit_code); 157 return base::GetTerminationStatus(process.process.Handle(), exit_code);
157 } 158 }
158 159
159 // static 160 // static
160 bool ChildProcessLauncherHelper::TerminateProcess( 161 bool ChildProcessLauncherHelper::TerminateProcess(
161 const base::Process& process, int exit_code, bool wait) { 162 const base::Process& process, int exit_code, bool wait) {
162 StopChildProcess(process.Handle()); 163 BrowserThread::PostTask(BrowserThread::PROCESS_LAUNCHER, FROM_HERE,
164 base::Bind(&StopChildProcess, process.Handle()));
163 return true; 165 return true;
164 } 166 }
165 167
166 // static 168 // static
167 void ChildProcessLauncherHelper::ForceNormalProcessTerminationSync( 169 void ChildProcessLauncherHelper::ForceNormalProcessTerminationSync(
168 ChildProcessLauncherHelper::Process process) { 170 ChildProcessLauncherHelper::Process process) {
169 DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); 171 DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER);
170 VLOG(1) << "ChromeProcess: Stopping process with handle " 172 VLOG(1) << "ChromeProcess: Stopping process with handle "
171 << process.process.Handle(); 173 << process.process.Handle();
172 StopChildProcess(process.process.Handle()); 174 StopChildProcess(process.process.Handle());
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 AttachCurrentThread())); 247 AttachCurrentThread()));
246 } 248 }
247 249
248 } // namespace internal 250 } // namespace internal
249 251
250 bool RegisterChildProcessLauncher(JNIEnv* env) { 252 bool RegisterChildProcessLauncher(JNIEnv* env) {
251 return internal::RegisterNativesImpl(env); 253 return internal::RegisterNativesImpl(env);
252 } 254 }
253 255
254 } // namespace content 256 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/public/android/java/src/org/chromium/content/browser/ChildConnectionAllocator.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698