diff options
author | gspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-19 18:25:47 +0000 |
---|---|---|
committer | gspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-19 18:25:47 +0000 |
commit | 22b61bab774f40b8388a5e1e5ae0c8b60f34bcc5 (patch) | |
tree | 670434c4208ff2a820b5d652274857b40c370e59 /chrome | |
parent | 3de2b0deb44020852a096946bd6a7c1d6033442c (diff) | |
download | chromium_src-22b61bab774f40b8388a5e1e5ae0c8b60f34bcc5.zip chromium_src-22b61bab774f40b8388a5e1e5ae0c8b60f34bcc5.tar.gz chromium_src-22b61bab774f40b8388a5e1e5ae0c8b60f34bcc5.tar.bz2 |
Revert 63067 - This adds some plumbing for propagating the status and error code of a
renderer process that went away so that we can tell at the UI level
what happened to the tab: did it crash, or was it killed by the OOM
killer (or some other reason). This is in preparation for implementing
a new UI for when a process is killed by the OOM on ChromeOS which
handles it differently from a crash.
Most of the changes are modifications of the argument list to include
a status and error code for the exited process, but in addition the
following was done:
- Changed the name of DidProcessCrash to GetTerminationStatus.
- Added some new enum values to TerminationStatus enum (and named it)
in process_util.h, so it can be used as the status returned by
WhatHappenedToProcess.
- Improved process_util_unittest to actually test for crashing and
terminated processes on all platforms.
- Added a new notification for renderers that were killed.
- Added error code information to crash notification.
- Added status and error code information to renderer IPC message for
RenderViewGone.
- Added a UMA histogram count for number of renderer kills.
[This change was previously reviewed and LGTM'd:
http://codereview.chromium.org/3386014/show
but due to issues with "git cl push" was never committed to the tree.]
BUG=none
TEST=ran new unit test. Test passes on try servers.
Review URL: http://codereview.chromium.org/3869001
TBR=gspencer@chromium.org
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63074 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
49 files changed, 131 insertions, 230 deletions
diff --git a/chrome/browser/browser_child_process_host.cc b/chrome/browser/browser_child_process_host.cc index 35660ab..a317f26 100644 --- a/chrome/browser/browser_child_process_host.cc +++ b/chrome/browser/browser_child_process_host.cc @@ -131,34 +131,18 @@ void BrowserChildProcessHost::Notify(NotificationType type) { BrowserThread::UI, FROM_HERE, new ChildNotificationTask(type, this)); } -base::TerminationStatus BrowserChildProcessHost::GetChildTerminationStatus( - int* exit_code) { - return child_process_->GetChildTerminationStatus(exit_code); +bool BrowserChildProcessHost::DidChildCrash() { + return child_process_->DidProcessCrash(); } void BrowserChildProcessHost::OnChildDied() { if (handle() != base::kNullProcessHandle) { - int exit_code; - base::TerminationStatus status = GetChildTerminationStatus(&exit_code); - switch (status) { - case base::TERMINATION_STATUS_PROCESS_CRASHED: { - OnProcessCrashed(exit_code); - - // Report that this child process crashed. - Notify(NotificationType::CHILD_PROCESS_CRASHED); - UMA_HISTOGRAM_COUNTS("ChildProcess.Crashes", this->type()); - break; - } - case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: { - OnProcessWasKilled(exit_code); - - // Report that this child process was killed. - Notify(NotificationType::CHILD_PROCESS_WAS_KILLED); - UMA_HISTOGRAM_COUNTS("ChildProcess.Kills", this->type()); - break; - } - default: - break; + bool did_crash = DidChildCrash(); + if (did_crash) { + OnProcessCrashed(); + // Report that this child process crashed. + Notify(NotificationType::CHILD_PROCESS_CRASHED); + UMA_HISTOGRAM_COUNTS("ChildProcess.Crashes", this->type()); } // Notify in the main loop of the disconnection. Notify(NotificationType::CHILD_PROCESS_HOST_DISCONNECTED); diff --git a/chrome/browser/browser_child_process_host.h b/chrome/browser/browser_child_process_host.h index 9d343d09..cf30973 100644 --- a/chrome/browser/browser_child_process_host.h +++ b/chrome/browser/browser_child_process_host.h @@ -74,25 +74,12 @@ class BrowserChildProcessHost : public ResourceDispatcherHost::Receiver, CommandLine* cmd_line); // ChildProcessLauncher::Client implementation. - virtual void OnProcessLaunched() {} + virtual void OnProcessLaunched() { } // Derived classes can override this to know if the process crashed. - // |exit_code| is the status returned when the process crashed (for - // posix, as returned from waitpid(), for Windows, as returned from - // GetExitCodeProcess()). - virtual void OnProcessCrashed(int exit_code) {} - - // Derived classes can override this to know if the process was - // killed. |exit_code| is the status returned when the process - // was killed (for posix, as returned from waitpid(), for Windows, - // as returned from GetExitCodeProcess()). - virtual void OnProcessWasKilled(int exit_code) {} - - // Returns the termination status of a child. |exit_code| is the - // status returned when the process exited (for posix, as returned - // from waitpid(), for Windows, as returned from - // GetExitCodeProcess()). |exit_code| may be NULL. - virtual base::TerminationStatus GetChildTerminationStatus(int* exit_code); + virtual void OnProcessCrashed() {} + + virtual bool DidChildCrash(); // Overrides from ChildProcessHost virtual void OnChildDied(); @@ -120,3 +107,4 @@ class BrowserChildProcessHost : public ResourceDispatcherHost::Receiver, }; #endif // CHROME_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ + diff --git a/chrome/browser/child_process_launcher.cc b/chrome/browser/child_process_launcher.cc index 426fc4c..f215084 100644 --- a/chrome/browser/child_process_launcher.cc +++ b/chrome/browser/child_process_launcher.cc @@ -310,30 +310,27 @@ base::ProcessHandle ChildProcessLauncher::GetHandle() { return context_->process_.handle(); } -base::TerminationStatus ChildProcessLauncher::GetChildTerminationStatus( - int* exit_code) { - base::TerminationStatus status; +bool ChildProcessLauncher::DidProcessCrash() { + bool did_crash, child_exited; base::ProcessHandle handle = context_->process_.handle(); #if defined(OS_LINUX) if (context_->zygote_) { - status = Singleton<ZygoteHost>()->GetTerminationStatus(handle, - exit_code); + did_crash = Singleton<ZygoteHost>()->DidProcessCrash(handle, &child_exited); } else #endif { - status = base::GetTerminationStatus(handle, exit_code); + did_crash = base::DidProcessCrash(&child_exited, handle); } - // POSIX: If the process crashed, then the kernel closed the socket - // for it and so the child has already died by the time we get - // here. Since GetTerminationStatus called waitpid with WNOHANG, - // it'll reap the process. However, if GetTerminationStatus didn't - // reap the child (because it was still running), we'll need to + // POSIX: If the process crashed, then the kernel closed the socket for it + // and so the child has already died by the time we get here. Since + // DidProcessCrash called waitpid with WNOHANG, it'll reap the process. + // However, if DidProcessCrash didn't reap the child, we'll need to in // Terminate via ProcessWatcher. So we can't close the handle here. - if (status != base::TERMINATION_STATUS_STILL_RUNNING) + if (child_exited) context_->process_.Close(); - return status; + return did_crash; } void ChildProcessLauncher::SetProcessBackgrounded(bool background) { diff --git a/chrome/browser/child_process_launcher.h b/chrome/browser/child_process_launcher.h index a3add53..95fb6ea 100644 --- a/chrome/browser/child_process_launcher.h +++ b/chrome/browser/child_process_launcher.h @@ -50,11 +50,8 @@ class ChildProcessLauncher { // Getter for the process handle. Only call after the process has started. base::ProcessHandle GetHandle(); - // Call this when the child process exits to know what happened to - // it. |exit_code| is the exit code of the process if it exited - // (e.g. status from waitpid if on posix, from GetExitCodeProcess on - // Windows). |exit_code| may be NULL. - base::TerminationStatus GetChildTerminationStatus(int* exit_code); + // Call this when the process exits to know if a process crashed or not. + bool DidProcessCrash(); // Changes whether the process runs in the background or not. Only call // this after the process has started. diff --git a/chrome/browser/child_process_security_policy_browsertest.cc b/chrome/browser/child_process_security_policy_browsertest.cc index 5c51b75..336ba24 100644 --- a/chrome/browser/child_process_security_policy_browsertest.cc +++ b/chrome/browser/child_process_security_policy_browsertest.cc @@ -43,7 +43,7 @@ IN_PROC_BROWSER_TEST_F(ChildProcessSecurityPolicyInProcessBrowserTest, NoLeak) { TabContents* tab = browser()->GetTabContentsAt(0); ASSERT_TRUE(tab != NULL); base::KillProcess(tab->GetRenderProcessHost()->GetHandle(), - base::TERMINATION_STATUS_PROCESS_WAS_KILLED, true); + base::PROCESS_END_KILLED_BY_USER, true); tab->controller().Reload(true); EXPECT_EQ( diff --git a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc index 4518569..32b67af 100644 --- a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc +++ b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc @@ -61,7 +61,7 @@ class ExtensionCrashRecoveryTest : public ExtensionBrowserTest { RenderProcessHost* extension_rph = extension_host->render_view_host()->process(); base::KillProcess(extension_rph->GetHandle(), - base::TERMINATION_STATUS_PROCESS_WAS_KILLED, false); + base::PROCESS_END_KILLED_BY_USER, false); ASSERT_TRUE(WaitForExtensionCrash(extension_id)); ASSERT_FALSE( GetExtensionProcessManager()->GetBackgroundHostForExtension(extension)); diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker.cc b/chrome/browser/extensions/sandboxed_extension_unpacker.cc index 300582d..fc8aea8 100644 --- a/chrome/browser/extensions/sandboxed_extension_unpacker.cc +++ b/chrome/browser/extensions/sandboxed_extension_unpacker.cc @@ -172,7 +172,7 @@ void SandboxedExtensionUnpacker::OnUnpackExtensionFailed( ReportFailure(error); } -void SandboxedExtensionUnpacker::OnProcessCrashed(int exit_code) { +void SandboxedExtensionUnpacker::OnProcessCrashed() { // Don't report crashes if they happen after we got a response. if (got_response_) return; diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker.h b/chrome/browser/extensions/sandboxed_extension_unpacker.h index 794f2e1..8df1414 100644 --- a/chrome/browser/extensions/sandboxed_extension_unpacker.h +++ b/chrome/browser/extensions/sandboxed_extension_unpacker.h @@ -124,7 +124,7 @@ class SandboxedExtensionUnpacker : public UtilityProcessHost::Client { // SandboxedExtensionUnpacker void OnUnpackExtensionSucceeded(const DictionaryValue& manifest); void OnUnpackExtensionFailed(const std::string& error_message); - void OnProcessCrashed(int exit_code); + void OnProcessCrashed(); void ReportFailure(const std::string& message); void ReportSuccess(); diff --git a/chrome/browser/importer/importer.cc b/chrome/browser/importer/importer.cc index 766e59e..9a40471 100644 --- a/chrome/browser/importer/importer.cc +++ b/chrome/browser/importer/importer.cc @@ -437,7 +437,7 @@ void ExternalProcessImporterClient::NotifyItemFinishedOnIOThread( profile_import_process_host_->ReportImportItemFinished(import_item); } -void ExternalProcessImporterClient::OnProcessCrashed(int exit_code) { +void ExternalProcessImporterClient::OnProcessCrashed() { if (cancelled_) return; diff --git a/chrome/browser/importer/importer.h b/chrome/browser/importer/importer.h index d1668d3..4887138 100644 --- a/chrome/browser/importer/importer.h +++ b/chrome/browser/importer/importer.h @@ -327,7 +327,7 @@ class ExternalProcessImporterClient void NotifyItemFinishedOnIOThread(importer::ImportItem import_item); // Cancel import on process crash. - virtual void OnProcessCrashed(int exit_code); + virtual void OnProcessCrashed(); // Notifies the importerhost that import has finished, and calls Release(). void Cleanup(); diff --git a/chrome/browser/in_process_webkit/indexed_db_key_utility_client.cc b/chrome/browser/in_process_webkit/indexed_db_key_utility_client.cc index e287c2c..6667d50 100644 --- a/chrome/browser/in_process_webkit/indexed_db_key_utility_client.cc +++ b/chrome/browser/in_process_webkit/indexed_db_key_utility_client.cc @@ -1,6 +1,6 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this +// source code is governed by a BSD-style license that can be found in the +// LICENSE file. #include "chrome/browser/in_process_webkit/indexed_db_key_utility_client.h" @@ -148,7 +148,7 @@ IndexedDBKeyUtilityClient::Client::Client(IndexedDBKeyUtilityClient* parent) : parent_(parent) { } -void IndexedDBKeyUtilityClient::Client::OnProcessCrashed(int exit_code) { +void IndexedDBKeyUtilityClient::Client::OnProcessCrashed() { if (parent_->state_ == STATE_CREATING_KEYS) parent_->FinishCreatingKeys(); } diff --git a/chrome/browser/in_process_webkit/indexed_db_key_utility_client.h b/chrome/browser/in_process_webkit/indexed_db_key_utility_client.h index 6b8aec1..ee03ed9 100644 --- a/chrome/browser/in_process_webkit/indexed_db_key_utility_client.h +++ b/chrome/browser/in_process_webkit/indexed_db_key_utility_client.h @@ -45,7 +45,7 @@ class IndexedDBKeyUtilityClient explicit Client(IndexedDBKeyUtilityClient* parent); // UtilityProcessHost::Client - virtual void OnProcessCrashed(int exit_code); + virtual void OnProcessCrashed(); virtual void OnIDBKeysFromValuesAndKeyPathSucceeded( int id, const std::vector<IndexedDBKey>& keys); virtual void OnIDBKeysFromValuesAndKeyPathFailed(int id); diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index 49f3fdb..37b79b7 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -610,8 +610,7 @@ void MetricsService::Observe(NotificationType type, { RenderProcessHost::RendererClosedDetails* process_details = Details<RenderProcessHost::RendererClosedDetails>(details).ptr(); - if (process_details->status == - base::TERMINATION_STATUS_PROCESS_CRASHED) { + if (process_details->did_crash) { if (process_details->was_extension_renderer) { LogExtensionRendererCrash(); } else { diff --git a/chrome/browser/nacl_host/nacl_process_host.cc b/chrome/browser/nacl_host/nacl_process_host.cc index 2540d8c..1ee53b9 100644 --- a/chrome/browser/nacl_host/nacl_process_host.cc +++ b/chrome/browser/nacl_host/nacl_process_host.cc @@ -162,11 +162,10 @@ void NaClProcessHost::OnProcessLaunchedByBroker(base::ProcessHandle handle) { OnProcessLaunched(); } -base::TerminationStatus NaClProcessHost::GetChildTerminationStatus( - int* exit_code) { +bool NaClProcessHost::DidChildCrash() { if (running_on_wow64_) - return base::GetTerminationStatus(handle(), exit_code); - return BrowserChildProcessHost::GetChildTerminationStatus(exit_code); + return base::DidProcessCrash(NULL, handle()); + return BrowserChildProcessHost::DidChildCrash(); } void NaClProcessHost::OnChildDied() { diff --git a/chrome/browser/nacl_host/nacl_process_host.h b/chrome/browser/nacl_host/nacl_process_host.h index afd3e2d..618492a 100644 --- a/chrome/browser/nacl_host/nacl_process_host.h +++ b/chrome/browser/nacl_host/nacl_process_host.h @@ -37,7 +37,7 @@ class NaClProcessHost : public BrowserChildProcessHost { void OnProcessLaunchedByBroker(base::ProcessHandle handle); protected: - virtual base::TerminationStatus GetChildTerminationStatus(int* exit_code); + virtual bool DidChildCrash(); virtual void OnChildDied(); private: diff --git a/chrome/browser/profile_import_process_host.cc b/chrome/browser/profile_import_process_host.cc index 45ec4f6..26e4ec1 100644 --- a/chrome/browser/profile_import_process_host.cc +++ b/chrome/browser/profile_import_process_host.cc @@ -127,13 +127,12 @@ void ProfileImportProcessHost::OnMessageReceived(const IPC::Message& message) { message)); } -void ProfileImportProcessHost::OnProcessCrashed(int exit_code) { +void ProfileImportProcessHost::OnProcessCrashed() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); BrowserThread::PostTask( thread_id_, FROM_HERE, NewRunnableMethod(import_process_client_.get(), - &ImportProcessClient::OnProcessCrashed, - exit_code)); + &ImportProcessClient::OnProcessCrashed)); } bool ProfileImportProcessHost::CanShutdown() { diff --git a/chrome/browser/profile_import_process_host.h b/chrome/browser/profile_import_process_host.h index 2e77573d..a9d5805 100644 --- a/chrome/browser/profile_import_process_host.h +++ b/chrome/browser/profile_import_process_host.h @@ -40,7 +40,7 @@ class ProfileImportProcessHost : public BrowserChildProcessHost { // These methods are used by the ProfileImportProcessHost to pass messages // received from the external process back to the ImportProcessClient in // ImporterHost. - virtual void OnProcessCrashed(int exit_status) {} + virtual void OnProcessCrashed() {} virtual void OnImportStart() {} virtual void OnImportFinished(bool succeeded, std::string error_msg) {} virtual void OnImportItemStart(int item) {} @@ -126,7 +126,7 @@ class ProfileImportProcessHost : public BrowserChildProcessHost { void OnMessageReceived(const IPC::Message& message); // Overridden from BrowserChildProcessHost: - virtual void OnProcessCrashed(int exit_code); + virtual void OnProcessCrashed(); virtual bool CanShutdown(); virtual URLRequestContext* GetRequestContext( uint32 request_id, diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index 1832464..5e254e5 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -924,20 +924,16 @@ void BrowserRenderProcessHost::OnChannelError() { if (!channel_.get()) return; - // child_process_ can be NULL in single process mode or if fast - // termination happened. - int exit_code = 0; - base::TerminationStatus status = - child_process_.get() ? - child_process_->GetChildTerminationStatus(&exit_code) : - base::TERMINATION_STATUS_NORMAL_TERMINATION; - - if (status == base::TERMINATION_STATUS_PROCESS_CRASHED) { + // NULL in single process mode or if fast termination happened. + bool did_crash = + child_process_.get() ? child_process_->DidProcessCrash() : false; + + if (did_crash) { UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildCrashes", extension_process_ ? 2 : 1); } - RendererClosedDetails details(status, exit_code, extension_process_); + RendererClosedDetails details(did_crash, extension_process_); NotificationService::current()->Notify( NotificationType::RENDERER_PROCESS_CLOSED, Source<RenderProcessHost>(this), @@ -950,9 +946,7 @@ void BrowserRenderProcessHost::OnChannelError() { IDMap<IPC::Channel::Listener>::iterator iter(&listeners_); while (!iter.IsAtEnd()) { iter.GetCurrentValue()->OnMessageReceived( - ViewHostMsg_RenderViewGone(iter.GetCurrentKey(), - static_cast<int>(status), - exit_code)); + ViewHostMsg_RenderViewGone(iter.GetCurrentKey())); iter.Advance(); } diff --git a/chrome/browser/renderer_host/render_process_host.h b/chrome/browser/renderer_host/render_process_host.h index c9a8abc..a5fd378 100644 --- a/chrome/browser/renderer_host/render_process_host.h +++ b/chrome/browser/renderer_host/render_process_host.h @@ -11,7 +11,6 @@ #include "app/surface/transport_dib.h" #include "base/id_map.h" #include "base/process.h" -#include "base/process_util.h" #include "base/scoped_ptr.h" #include "base/time.h" #include "chrome/common/visitedlink_common.h" @@ -49,15 +48,11 @@ class RenderProcessHost : public IPC::Channel::Sender, // Details for RENDERER_PROCESS_CLOSED notifications. struct RendererClosedDetails { - RendererClosedDetails(base::TerminationStatus status, - int exit_code, - bool was_extension_renderer) { - this->status = status; - this->exit_code = exit_code; + RendererClosedDetails(bool did_crash, bool was_extension_renderer) { + this->did_crash = did_crash; this->was_extension_renderer = was_extension_renderer; } - base::TerminationStatus status; - int exit_code; + bool did_crash; bool was_extension_renderer; }; diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index 21c3675..3781bed 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -981,13 +981,11 @@ void RenderViewHost::OnMsgRenderViewReady() { delegate_->RenderViewReady(this); } -void RenderViewHost::OnMsgRenderViewGone(int status, int exit_code) { +void RenderViewHost::OnMsgRenderViewGone() { // Our base class RenderWidgetHost needs to reset some stuff. - RendererExited(static_cast<base::TerminationStatus>(status), exit_code); + RendererExited(); - delegate_->RenderViewGone(this, - static_cast<base::TerminationStatus>(status), - exit_code); + delegate_->RenderViewGone(this); } // Called when the renderer navigates. For every frame loaded, we'll get this diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h index 1636d4e..76f1f01 100644 --- a/chrome/browser/renderer_host/render_view_host.h +++ b/chrome/browser/renderer_host/render_view_host.h @@ -525,7 +525,7 @@ class RenderViewHost : public RenderWidgetHost { void OnMsgShowFullscreenWidget(int route_id); void OnMsgRunModal(IPC::Message* reply_msg); void OnMsgRenderViewReady(); - void OnMsgRenderViewGone(int status, int error_code); + void OnMsgRenderViewGone(); void OnMsgNavigate(const IPC::Message& msg); void OnMsgUpdateState(int32 page_id, const std::string& state); diff --git a/chrome/browser/renderer_host/render_view_host_delegate.h b/chrome/browser/renderer_host/render_view_host_delegate.h index a75cb1d..d0c88d6 100644 --- a/chrome/browser/renderer_host/render_view_host_delegate.h +++ b/chrome/browser/renderer_host/render_view_host_delegate.h @@ -10,7 +10,6 @@ #include <vector> #include "base/basictypes.h" -#include "base/process_util.h" #include "base/ref_counted.h" #include "base/string16.h" #include "chrome/common/content_settings_types.h" @@ -683,9 +682,7 @@ class RenderViewHostDelegate { virtual void RenderViewReady(RenderViewHost* render_view_host) {} // The RenderView died somehow (crashed or was killed by the user). - virtual void RenderViewGone(RenderViewHost* render_view_host, - base::TerminationStatus status, - int error_code) {} + virtual void RenderViewGone(RenderViewHost* render_view_host) {} // The RenderView is going to be deleted. This is called when each // RenderView is going to be destroyed diff --git a/chrome/browser/renderer_host/render_widget_host.cc b/chrome/browser/renderer_host/render_widget_host.cc index 1487899..a6efd58 100644 --- a/chrome/browser/renderer_host/render_widget_host.cc +++ b/chrome/browser/renderer_host/render_widget_host.cc @@ -601,8 +601,7 @@ void RenderWidgetHost::ForwardEditCommandsForNextKeyEvent( // only handled by RenderView. } -void RenderWidgetHost::RendererExited(base::TerminationStatus status, - int exit_code) { +void RenderWidgetHost::RendererExited() { // Clearing this flag causes us to re-create the renderer when recovering // from a crashed renderer. renderer_initialized_ = false; @@ -627,7 +626,7 @@ void RenderWidgetHost::RendererExited(base::TerminationStatus status, is_hidden_ = false; if (view_) { - view_->RenderViewGone(status, exit_code); + view_->RenderViewGone(); view_ = NULL; // The View should be deleted by RenderViewGone. } @@ -737,7 +736,7 @@ void RenderWidgetHost::OnMsgRenderViewReady() { WasResized(); } -void RenderWidgetHost::OnMsgRenderViewGone(int status, int exit_code) { +void RenderWidgetHost::OnMsgRenderViewGone() { // TODO(evanm): This synchronously ends up calling "delete this". // Is that really what we want in response to this message? I'm matching // previous behavior of the code here. diff --git a/chrome/browser/renderer_host/render_widget_host.h b/chrome/browser/renderer_host/render_widget_host.h index 297d74a..6c3fed7 100644 --- a/chrome/browser/renderer_host/render_widget_host.h +++ b/chrome/browser/renderer_host/render_widget_host.h @@ -12,7 +12,6 @@ #include "app/surface/transport_dib.h" #include "base/gtest_prod_util.h" -#include "base/process_util.h" #include "base/scoped_ptr.h" #include "base/string16.h" #include "base/timer.h" @@ -415,7 +414,7 @@ class RenderWidgetHost : public IPC::Channel::Listener, // Called when we receive a notification indicating that the renderer // process has gone. This will reset our state so that our state will be // consistent if a new renderer is created. - void RendererExited(base::TerminationStatus status, int exit_code); + void RendererExited(); // Retrieves an id the renderer can use to refer to its view. // This is used for various IPC messages, including plugins. @@ -475,7 +474,7 @@ class RenderWidgetHost : public IPC::Channel::Listener, // IPC message handlers void OnMsgRenderViewReady(); - void OnMsgRenderViewGone(int status, int error_code); + void OnMsgRenderViewGone(); void OnMsgClose(); void OnMsgRequestMove(const gfx::Rect& pos); void OnMsgPaintAtSizeAck(int tag, const gfx::Size& size); diff --git a/chrome/browser/renderer_host/render_widget_host_unittest.cc b/chrome/browser/renderer_host/render_widget_host_unittest.cc index 9bd4fa3..1c5bb17 100644 --- a/chrome/browser/renderer_host/render_widget_host_unittest.cc +++ b/chrome/browser/renderer_host/render_widget_host_unittest.cc @@ -392,7 +392,7 @@ TEST_F(RenderWidgetHostTest, ResizeThenCrash) { // resize ack logic is cleared. Must clear the view first so it doesn't get // deleted. host_->set_view(NULL); - host_->RendererExited(base::TERMINATION_STATUS_PROCESS_CRASHED, -1); + host_->RendererExited(); EXPECT_FALSE(host_->resize_ack_pending_); EXPECT_EQ(gfx::Size(), host_->in_flight_size_); diff --git a/chrome/browser/renderer_host/render_widget_host_view.h b/chrome/browser/renderer_host/render_widget_host_view.h index 074fc88..46d6bda 100644 --- a/chrome/browser/renderer_host/render_widget_host_view.h +++ b/chrome/browser/renderer_host/render_widget_host_view.h @@ -14,11 +14,10 @@ #include <vector> #include "app/surface/transport_dib.h" -#include "base/process_util.h" #include "gfx/native_widget_types.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/WebKit/WebKit/chromium/public/WebPopupType.h" #include "third_party/WebKit/WebKit/chromium/public/WebTextInputType.h" -#include "third_party/skia/include/core/SkBitmap.h" namespace gfx { class Rect; @@ -153,8 +152,7 @@ class RenderWidgetHostView { const std::vector<gfx::Rect>& copy_rects) = 0; // Notifies the View that the renderer has ceased to exist. - virtual void RenderViewGone(base::TerminationStatus status, - int error_code) = 0; + virtual void RenderViewGone() = 0; // Notifies the View that the renderer will be delete soon. virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh) = 0; diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc index 77802a6..5f4a843 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc @@ -671,8 +671,7 @@ void RenderWidgetHostViewGtk::DidUpdateBackingStore( } } -void RenderWidgetHostViewGtk::RenderViewGone(base::TerminationStatus status, - int error_code) { +void RenderWidgetHostViewGtk::RenderViewGone() { Destroy(); plugin_container_manager_.set_host_widget(NULL); } diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.h b/chrome/browser/renderer_host/render_widget_host_view_gtk.h index 10a7626..099da46 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_gtk.h +++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.h @@ -75,8 +75,7 @@ class RenderWidgetHostViewGtk : public RenderWidgetHostView { virtual void DidUpdateBackingStore( const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, const std::vector<gfx::Rect>& copy_rects); - virtual void RenderViewGone(base::TerminationStatus status, - int error_code); + virtual void RenderViewGone(); virtual void Destroy(); virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh) {} virtual void SetTooltipText(const std::wstring& tooltip_text); diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.h b/chrome/browser/renderer_host/render_widget_host_view_mac.h index 909626e..b9e41f9 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_mac.h +++ b/chrome/browser/renderer_host/render_widget_host_view_mac.h @@ -207,8 +207,7 @@ class RenderWidgetHostViewMac : public RenderWidgetHostView { virtual void DidUpdateBackingStore( const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, const std::vector<gfx::Rect>& copy_rects); - virtual void RenderViewGone(base::TerminationStatus status, - int error_code); + virtual void RenderViewGone(); virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh) {}; virtual void Destroy(); virtual void SetTooltipText(const std::wstring& tooltip_text); diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm index 65473ed..3281a0e 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm +++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm @@ -713,8 +713,7 @@ void RenderWidgetHostViewMac::DidUpdateBackingStore( [cocoa_view_ displayIfNeeded]; } -void RenderWidgetHostViewMac::RenderViewGone(base::TerminationStatus status, - int error_code) { +void RenderWidgetHostViewMac::RenderViewGone() { // TODO(darin): keep this around, and draw sad-tab into it. UpdateCursorIfOverSelf(); Destroy(); diff --git a/chrome/browser/renderer_host/render_widget_host_view_views.cc b/chrome/browser/renderer_host/render_widget_host_view_views.cc index f0a044f..25e8a88 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_views.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_views.cc @@ -215,8 +215,7 @@ void RenderWidgetHostViewViews::DidUpdateBackingStore( } } -void RenderWidgetHostViewViews::RenderViewGone(base::TerminationStatus status, - int error_code) { +void RenderWidgetHostViewViews::RenderViewGone() { Destroy(); } @@ -314,7 +313,7 @@ void RenderWidgetHostViewViews::Paint(gfx::Canvas* canvas) { DCHECK(!about_to_validate_and_paint_); // TODO(anicolao): get the damage somehow - // invalid_rect_ = damage_rect; + //invalid_rect_ = damage_rect; invalid_rect_ = bounds(); about_to_validate_and_paint_ = true; BackingStoreX* backing_store = static_cast<BackingStoreX*>( diff --git a/chrome/browser/renderer_host/render_widget_host_view_views.h b/chrome/browser/renderer_host/render_widget_host_view_views.h index 3771393..331c1cd 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_views.h +++ b/chrome/browser/renderer_host/render_widget_host_view_views.h @@ -60,8 +60,7 @@ class RenderWidgetHostViewViews : public RenderWidgetHostView, virtual void DidUpdateBackingStore( const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, const std::vector<gfx::Rect>& copy_rects); - virtual void RenderViewGone(base::TerminationStatus status, - int error_code); + virtual void RenderViewGone(); virtual void Destroy(); virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh) {} virtual void SetTooltipText(const std::wstring& tooltip_text); diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc index ff90c06..0b66f0c 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc @@ -736,8 +736,7 @@ void RenderWidgetHostViewWin::DidUpdateBackingStore( Redraw(); } -void RenderWidgetHostViewWin::RenderViewGone(base::TerminationStatus status, - int error_code) { +void RenderWidgetHostViewWin::RenderViewGone() { // TODO(darin): keep this around, and draw sad-tab into it. UpdateCursorIfOverSelf(); being_destroyed_ = true; diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.h b/chrome/browser/renderer_host/render_widget_host_view_win.h index c401005..9fbaf11 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.h +++ b/chrome/browser/renderer_host/render_widget_host_view_win.h @@ -144,8 +144,7 @@ class RenderWidgetHostViewWin virtual void DidUpdateBackingStore( const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, const std::vector<gfx::Rect>& copy_rects); - virtual void RenderViewGone(base::TerminationStatus status, - int error_code); + virtual void RenderViewGone(); virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh); virtual void Destroy(); virtual void SetTooltipText(const std::wstring& tooltip_text); diff --git a/chrome/browser/renderer_host/test/test_render_view_host.h b/chrome/browser/renderer_host/test/test_render_view_host.h index e3c22c14..e3c9f39 100644 --- a/chrome/browser/renderer_host/test/test_render_view_host.h +++ b/chrome/browser/renderer_host/test/test_render_view_host.h @@ -81,8 +81,7 @@ class TestRenderWidgetHostView : public RenderWidgetHostView { virtual void DidUpdateBackingStore( const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, const std::vector<gfx::Rect>& rects) {} - virtual void RenderViewGone(base::TerminationStatus status, - int error_code) { delete this; } + virtual void RenderViewGone() { delete this; } virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh) { } virtual void Destroy() {} virtual void PrepareToDestroy() {} diff --git a/chrome/browser/renderer_host/test/web_cache_manager_browsertest.cc b/chrome/browser/renderer_host/test/web_cache_manager_browsertest.cc index 84dbde0..0779b00 100644 --- a/chrome/browser/renderer_host/test/web_cache_manager_browsertest.cc +++ b/chrome/browser/renderer_host/test/web_cache_manager_browsertest.cc @@ -33,7 +33,7 @@ IN_PROC_BROWSER_TEST_F(WebCacheManagerBrowserTest, FLAKY_CrashOnceOnly) { TabContents* tab = browser()->GetTabContentsAt(0); ASSERT_TRUE(tab != NULL); base::KillProcess(tab->GetRenderProcessHost()->GetHandle(), - base::TERMINATION_STATUS_PROCESS_WAS_KILLED, true); + base::PROCESS_END_KILLED_BY_USER, true); browser()->SelectTabContentsAt(0, true); browser()->NewTab(); diff --git a/chrome/browser/tab_contents/interstitial_page.cc b/chrome/browser/tab_contents/interstitial_page.cc index 8fd9f7f..8663eef 100644 --- a/chrome/browser/tab_contents/interstitial_page.cc +++ b/chrome/browser/tab_contents/interstitial_page.cc @@ -327,9 +327,7 @@ const GURL& InterstitialPage::GetURL() const { return url_; } -void InterstitialPage::RenderViewGone(RenderViewHost* render_view_host, - base::TerminationStatus status, - int error_code) { +void InterstitialPage::RenderViewGone(RenderViewHost* render_view_host) { // Our renderer died. This should not happen in normal cases. // Just dismiss the interstitial. DontProceed(); diff --git a/chrome/browser/tab_contents/interstitial_page.h b/chrome/browser/tab_contents/interstitial_page.h index 2faad77..50ede04 100644 --- a/chrome/browser/tab_contents/interstitial_page.h +++ b/chrome/browser/tab_contents/interstitial_page.h @@ -9,7 +9,6 @@ #include <map> #include <string> -#include "base/process_util.h" #include "base/scoped_ptr.h" #include "chrome/browser/renderer_host/render_view_host_delegate.h" #include "chrome/common/notification_observer.h" @@ -125,9 +124,7 @@ class InterstitialPage : public NotificationObserver, // RenderViewHostDelegate implementation: virtual View* GetViewDelegate(); virtual const GURL& GetURL() const; - virtual void RenderViewGone(RenderViewHost* render_view_host, - base::TerminationStatus status, - int error_code); + virtual void RenderViewGone(RenderViewHost* render_view_host); virtual void DidNavigate(RenderViewHost* render_view_host, const ViewHostMsg_FrameNavigate_Params& params); virtual void UpdateTitle(RenderViewHost* render_view_host, diff --git a/chrome/browser/tab_contents/web_contents_unittest.cc b/chrome/browser/tab_contents/web_contents_unittest.cc index 67d93a3..abb1578 100644 --- a/chrome/browser/tab_contents/web_contents_unittest.cc +++ b/chrome/browser/tab_contents/web_contents_unittest.cc @@ -120,8 +120,8 @@ class TestInterstitialPage : public InterstitialPage { DidNavigate(render_view_host(), params); } - void TestRenderViewGone(base::TerminationStatus status, int error_code) { - RenderViewGone(render_view_host(), status, error_code); + void TestRenderViewGone() { + RenderViewGone(render_view_host()); } bool is_showing() const { @@ -1151,9 +1151,7 @@ TEST_F(TabContentsTest, ShowInterstitialCrashRendererThenGoBack) { interstitial->TestDidNavigate(2, interstitial_url); // Crash the renderer - rvh()->TestOnMessageReceived( - ViewHostMsg_RenderViewGone( - 0, base::TERMINATION_STATUS_PROCESS_CRASHED, -1)); + rvh()->TestOnMessageReceived(ViewHostMsg_RenderViewGone(0)); // While the interstitial is showing, go back. controller().GoBack(); @@ -1188,9 +1186,7 @@ TEST_F(TabContentsTest, ShowInterstitialCrashRendererThenNavigate) { interstitial->Show(); // Crash the renderer - rvh()->TestOnMessageReceived( - ViewHostMsg_RenderViewGone( - 0, base::TERMINATION_STATUS_PROCESS_CRASHED, -1)); + rvh()->TestOnMessageReceived(ViewHostMsg_RenderViewGone(0)); interstitial->TestDidNavigate(2, interstitial_url); } @@ -1433,8 +1429,7 @@ TEST_F(TabContentsTest, InterstitialCrasher) { TestInterstitialPageStateGuard state_guard(interstitial); interstitial->Show(); // Simulate a renderer crash before the interstitial is shown. - interstitial->TestRenderViewGone( - base::TERMINATION_STATUS_PROCESS_CRASHED, -1); + interstitial->TestRenderViewGone(); // The interstitial should have been dismissed. EXPECT_TRUE(deleted); EXPECT_EQ(TestInterstitialPage::CANCELED, state); @@ -1445,8 +1440,7 @@ TEST_F(TabContentsTest, InterstitialCrasher) { interstitial->Show(); interstitial->TestDidNavigate(1, url); // Simulate a renderer crash. - interstitial->TestRenderViewGone( - base::TERMINATION_STATUS_PROCESS_CRASHED, -1); + interstitial->TestRenderViewGone(); // The interstitial should have been dismissed. EXPECT_TRUE(deleted); EXPECT_EQ(TestInterstitialPage::CANCELED, state); diff --git a/chrome/browser/task_manager/task_manager.cc b/chrome/browser/task_manager/task_manager.cc index df102e1..0793a4d 100644 --- a/chrome/browser/task_manager/task_manager.cc +++ b/chrome/browser/task_manager/task_manager.cc @@ -895,7 +895,7 @@ void TaskManager::KillProcess(int index) { base::ProcessHandle process = model_->GetResourceProcessHandle(index); DCHECK(process); if (process != base::GetCurrentProcessHandle()) - base::KillProcess(process, base::PROCESS_END_PROCESS_WAS_KILLED, false); + base::KillProcess(process, base::PROCESS_END_KILLED_BY_USER, false); } void TaskManager::ActivateProcess(int index) { diff --git a/chrome/browser/utility_process_host.cc b/chrome/browser/utility_process_host.cc index 9805071..22495f8 100644 --- a/chrome/browser/utility_process_host.cc +++ b/chrome/browser/utility_process_host.cc @@ -159,10 +159,10 @@ void UtilityProcessHost::OnMessageReceived(const IPC::Message& message) { NewRunnableMethod(client_.get(), &Client::OnMessageReceived, message)); } -void UtilityProcessHost::OnProcessCrashed(int exit_code) { +void UtilityProcessHost::OnProcessCrashed() { BrowserThread::PostTask( client_thread_id_, FROM_HERE, - NewRunnableMethod(client_.get(), &Client::OnProcessCrashed, exit_code)); + NewRunnableMethod(client_.get(), &Client::OnProcessCrashed)); } void UtilityProcessHost::Client::OnMessageReceived( diff --git a/chrome/browser/utility_process_host.h b/chrome/browser/utility_process_host.h index da2a05a..48d5e38 100644 --- a/chrome/browser/utility_process_host.h +++ b/chrome/browser/utility_process_host.h @@ -39,7 +39,7 @@ class UtilityProcessHost : public BrowserChildProcessHost { Client() {} // Called when the process has crashed. - virtual void OnProcessCrashed(int exit_code) {} + virtual void OnProcessCrashed() {} // Called when the extension has unpacked successfully. |manifest| is the // parsed manifest.json file. |catalogs| contains list of all parsed @@ -153,7 +153,7 @@ class UtilityProcessHost : public BrowserChildProcessHost { void OnMessageReceived(const IPC::Message& message); // BrowserChildProcessHost: - virtual void OnProcessCrashed(int exit_code); + virtual void OnProcessCrashed(); virtual bool CanShutdown() { return true; } virtual URLRequestContext* GetRequestContext( uint32 request_id, diff --git a/chrome/browser/web_resource/web_resource_service.cc b/chrome/browser/web_resource/web_resource_service.cc index dbc7fac..7c8a1ba 100644 --- a/chrome/browser/web_resource/web_resource_service.cc +++ b/chrome/browser/web_resource/web_resource_service.cc @@ -141,7 +141,7 @@ class WebResourceService::UnpackerClient ~UnpackerClient() {} // UtilityProcessHost::Client - virtual void OnProcessCrashed(int exit_code) { + virtual void OnProcessCrashed() { if (got_response_) return; diff --git a/chrome/browser/zygote_host_linux.cc b/chrome/browser/zygote_host_linux.cc index f88c597..d88c9be 100644 --- a/chrome/browser/zygote_host_linux.cc +++ b/chrome/browser/zygote_host_linux.cc @@ -306,18 +306,13 @@ void ZygoteHost::EnsureProcessTerminated(pid_t process) { PLOG(ERROR) << "write"; } -base::TerminationStatus ZygoteHost::GetTerminationStatus( - base::ProcessHandle handle, - int* exit_code) { +bool ZygoteHost::DidProcessCrash(base::ProcessHandle handle, + bool* child_exited) { DCHECK(init_); Pickle pickle; - pickle.WriteInt(kCmdGetTerminationStatus); + pickle.WriteInt(kCmdDidProcessCrash); pickle.WriteInt(handle); - // Set this now to handle the early termination cases. - if (exit_code) - *exit_code = 0; - static const unsigned kMaxMessageLength = 128; char buf[kMaxMessageLength]; ssize_t len; @@ -331,23 +326,23 @@ base::TerminationStatus ZygoteHost::GetTerminationStatus( if (len == -1) { LOG(WARNING) << "Error reading message from zygote: " << errno; - return base::TERMINATION_STATUS_NORMAL_TERMINATION; + return false; } else if (len == 0) { LOG(WARNING) << "Socket closed prematurely."; - return base::TERMINATION_STATUS_NORMAL_TERMINATION; + return false; } Pickle read_pickle(buf, len); - int status, tmp_exit_code; + bool did_crash, tmp_child_exited; void* iter = NULL; - if (!read_pickle.ReadInt(&iter, &status) || - !read_pickle.ReadInt(&iter, &tmp_exit_code)) { - LOG(WARNING) << "Error parsing GetTerminationStatus response from zygote."; - return base::TERMINATION_STATUS_NORMAL_TERMINATION; + if (!read_pickle.ReadBool(&iter, &did_crash) || + !read_pickle.ReadBool(&iter, &tmp_child_exited)) { + LOG(WARNING) << "Error parsing DidProcessCrash response from zygote."; + return false; } - if (exit_code) - *exit_code = tmp_exit_code; + if (child_exited) + *child_exited = tmp_child_exited; - return static_cast<base::TerminationStatus>(status); + return did_crash; } diff --git a/chrome/browser/zygote_host_linux.h b/chrome/browser/zygote_host_linux.h index 68a72ed..dd00336 100644 --- a/chrome/browser/zygote_host_linux.h +++ b/chrome/browser/zygote_host_linux.h @@ -14,7 +14,6 @@ #include "base/global_descriptors_posix.h" #include "base/lock.h" #include "base/process.h" -#include "base/process_util.h" template<typename Type> struct DefaultSingletonTraits; @@ -35,18 +34,17 @@ class ZygoteHost { const base::GlobalDescriptors::Mapping& mapping); void EnsureProcessTerminated(pid_t process); - // Get the termination status (and, optionally, the exit code) of - // the process. |exit_code| is set to the exit code of the child - // process. (|exit_code| may be NULL.) - base::TerminationStatus GetTerminationStatus(base::ProcessHandle handle, - int* exit_code); + // Get the termination status (exit code) of the process and return true if + // the status indicates the process crashed. |child_exited| is set to true + // iff the child process has terminated. (|child_exited| may be NULL.) + bool DidProcessCrash(base::ProcessHandle handle, bool* child_exited); // These are the command codes used on the wire between the browser and the // zygote. enum { kCmdFork = 0, // Fork off a new renderer. kCmdReap = 1, // Reap a renderer child. - kCmdGetTerminationStatus = 2, // Check what happend to a child process. + kCmdDidProcessCrash = 2, // Check if child process crashed. kCmdGetSandboxStatus = 3, // Read a bitmask of kSandbox* }; diff --git a/chrome/browser/zygote_main_linux.cc b/chrome/browser/zygote_main_linux.cc index 2ab36e2..65a44ae 100644 --- a/chrome/browser/zygote_main_linux.cc +++ b/chrome/browser/zygote_main_linux.cc @@ -167,10 +167,10 @@ class Zygote { break; HandleReapRequest(fd, pickle, iter); return false; - case ZygoteHost::kCmdGetTerminationStatus: + case ZygoteHost::kCmdDidProcessCrash: if (!fds.empty()) break; - HandleGetTerminationStatus(fd, pickle, iter); + HandleDidProcessCrash(fd, pickle, iter); return false; case ZygoteHost::kCmdGetSandboxStatus: HandleGetSandboxStatus(fd, pickle, iter); @@ -209,31 +209,26 @@ class Zygote { ProcessWatcher::EnsureProcessTerminated(actual_child); } - void HandleGetTerminationStatus(int fd, const Pickle& pickle, void* iter) { + void HandleDidProcessCrash(int fd, const Pickle& pickle, void* iter) { base::ProcessHandle child; if (!pickle.ReadInt(&iter, &child)) { - LOG(WARNING) << "Error parsing GetTerminationStatus request " - << "from browser"; + LOG(WARNING) << "Error parsing DidProcessCrash request from browser"; return; } - base::TerminationStatus status; - int exit_code; + bool child_exited; + bool did_crash; if (g_suid_sandbox_active) child = real_pids_to_sandbox_pids[child]; - if (child) { - status = base::GetTerminationStatus(child, &exit_code); - } else { - // Assume that if we can't find the child in the sandbox, then - // it terminated normally. - status = base::TERMINATION_STATUS_NORMAL_TERMINATION; - exit_code = 0; - } + if (child) + did_crash = base::DidProcessCrash(&child_exited, child); + else + did_crash = child_exited = false; Pickle write_pickle; - write_pickle.WriteInt(static_cast<int>(status)); - write_pickle.WriteInt(exit_code); + write_pickle.WriteBool(did_crash); + write_pickle.WriteBool(child_exited); if (HANDLE_EINTR(write(fd, write_pickle.data(), write_pickle.size())) != write_pickle.size()) { PLOG(ERROR) << "write"; diff --git a/chrome/common/notification_type.h b/chrome/common/notification_type.h index 5de67e7..1ba2c39 100644 --- a/chrome/common/notification_type.h +++ b/chrome/common/notification_type.h @@ -537,20 +537,12 @@ class NotificationType { // The details are in a Details<ChildProcessInfo>. CHILD_PROCESS_HOST_DISCONNECTED, - // This message is sent when a child process disappears - // unexpectedly as a result of a crash. There is no usable - // source, since it is sent from an ephemeral task; register for - // AllSources() to receive this notification. The details are in - // a Details<ChildProcessInfo>. + // This message is sent when a child process disappears unexpectedly. + // There is no usable source, since it is sent from an ephemeral task; + // register for AllSources() to receive this notification. The details are + // in a Details<ChildProcessInfo>. CHILD_PROCESS_CRASHED, - // This message is sent when a child process disappears - // unexpectedly as a result of a termination signal. There is no - // usable source, since it is sent from an ephemeral task; - // register for AllSources() to receive this notification. The - // details are in a Details<ChildProcessInfo>. - CHILD_PROCESS_WAS_KILLED, - // This message indicates that an instance of a particular child was // created in a page. (If one page contains several regions rendered by // the same child, this notification will occur once for each region diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index 40c1886..75eacdf 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -1163,9 +1163,7 @@ IPC_BEGIN_MESSAGES(ViewHost) // Indicates the renderer process is gone. This actually is sent by the // browser process to itself, but keeps the interface cleaner. - IPC_MESSAGE_ROUTED2(ViewHostMsg_RenderViewGone, - int, /* this really is base::TerminationStatus */ - int /* exit_code */) + IPC_MESSAGE_ROUTED0(ViewHostMsg_RenderViewGone) // Sent by the renderer process to request that the browser close the view. // This corresponds to the window.close() API, and the browser may ignore diff --git a/chrome/common/result_codes.h b/chrome/common/result_codes.h index 94ba503..6625cb0 100644 --- a/chrome/common/result_codes.h +++ b/chrome/common/result_codes.h @@ -21,9 +21,9 @@ class ResultCodes { public: enum ExitCode { - NORMAL_EXIT = base::TERMINATION_STATUS_NORMAL_TERMINATION, - TASKMAN_KILL = base::TERMINATION_STATUS_PROCESS_WAS_KILLED, - HUNG = base::TERMINATION_STATUS_PROCESS_WAS_HUNG, + NORMAL_EXIT = base::PROCESS_END_NORMAL_TERMINATION, + TASKMAN_KILL = base::PROCESS_END_KILLED_BY_USER, + HUNG = base::PROCESS_END_PROCESS_WAS_HUNG, INVALID_CMDLINE_URL, // An invalid command line url was given. SBOX_INIT_FAILED, // The sandbox could not be initialized. GOOGLE_UPDATE_INIT_FAILED, // The Google Update client stub init failed. |