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

Unified Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 740813004: Use StopChildProcess instead of base::KillProcess to kill a renderer process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comments Created 6 years 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_process_host_impl.cc
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index e683a1d5c25baca05e0e7108628f8f031ff46f3c..db8e30c4e39608a86dcad6a748b0c83641bad172 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -152,6 +152,7 @@
#include "ui/native_theme/native_theme_switches.h"
#if defined(OS_ANDROID)
+#include "content/browser/android/child_process_launcher_android.h"
#include "content/browser/media/android/browser_demuxer_android.h"
#include "content/browser/screen_orientation/screen_orientation_message_filter_android.h"
#endif
@@ -971,8 +972,7 @@ void RenderProcessHostImpl::ReceivedBadMessage() {
}
// We kill the renderer but don't include a NOTREACHED, because we want the
// browser to try to survive when it gets illegal messages from the renderer.
- base::KillProcess(GetHandle(), RESULT_CODE_KILLED_BAD_MESSAGE,
- false);
+ Shutdown(RESULT_CODE_KILLED_BAD_MESSAGE, false);
}
void RenderProcessHostImpl::WidgetRestored() {
@@ -1329,9 +1329,22 @@ base::ProcessHandle RenderProcessHostImpl::GetHandle() const {
return child_process_launcher_->GetProcess().Handle();
}
+bool RenderProcessHostImpl::Shutdown(int exit_code, bool wait) {
+ if (run_renderer_in_process())
+ return false; // Single process mode never shuts down the renderer.
+
+#if defined(OS_ANDROID)
+ // Android requires a different approach for killing.
+ StopChildProcess(GetHandle());
+ return true;
+#else
+ return base::KillProcess(GetHandle(), exit_code, wait);
+#endif
+}
+
bool RenderProcessHostImpl::FastShutdownIfPossible() {
if (run_renderer_in_process())
- return false; // Single process mode never shutdown the renderer.
+ return false; // Single process mode never shuts down the renderer.
if (!GetContentClient()->browser()->IsFastShutdownPossible())
return false;
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.h ('k') | content/browser/renderer_host/render_view_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698