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

Unified Diff: client/crashpad_client_mac.cc

Issue 1411313007: mac: Log a message when restarting crashpad_handler (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/crashpad_client_mac.cc
diff --git a/client/crashpad_client_mac.cc b/client/crashpad_client_mac.cc
index d5e3545b2094a312cb185bcfab081b6f402ca515..480828be78c115d6af0e1cf48690a2c33e8dadf5 100644
--- a/client/crashpad_client_mac.cc
+++ b/client/crashpad_client_mac.cc
@@ -164,7 +164,8 @@ class HandlerStarter final : public NotifyServer::DefaultInterface {
return base::mac::ScopedMachSendRight();
}
- if (handler_restarter && handler_restarter->StartRestartThread(
+ if (handler_restarter &&
+ handler_restarter->StartRestartThread(
handler, database, url, annotations, arguments)) {
// The thread owns the object now.
ignore_result(handler_restarter.release());
@@ -245,6 +246,8 @@ class HandlerStarter final : public NotifyServer::DefaultInterface {
base::mac::ScopedMachReceiveRight receive_right,
HandlerStarter* handler_restarter,
bool restart) {
+ DCHECK(!restart || handler_restarter);
+
if (handler_restarter) {
// The port-destroyed notification must be requested each time. It uses
// a send-once right, so once the notification is received, it won’t be
@@ -270,7 +273,7 @@ class HandlerStarter final : public NotifyServer::DefaultInterface {
DCHECK(restart || !previous_owner.is_valid());
}
- if (handler_restarter->last_start_time_) {
+ if (restart) {
// If the handler was ever started before, don’t restart it too quickly.
const uint64_t kNanosecondsPerSecond = 1E9;
const uint64_t kMinimumStartInterval = 1 * kNanosecondsPerSecond;
@@ -279,7 +282,14 @@ class HandlerStarter final : public NotifyServer::DefaultInterface {
handler_restarter->last_start_time_ + kMinimumStartInterval;
const uint64_t now_time = ClockMonotonicNanoseconds();
if (earliest_next_start_time > now_time) {
+ const uint64_t sleep_time = earliest_next_start_time - now_time;
+ LOG(INFO) << "restarting handler"
+ << base::StringPrintf(" in %.3fs",
+ static_cast<double>(sleep_time) /
+ kNanosecondsPerSecond);
SleepNanoseconds(earliest_next_start_time - now_time);
+ } else {
+ LOG(INFO) << "restarting handler";
}
}
@@ -517,13 +527,13 @@ bool CrashpadClient::StartHandler(
// The “restartable” behavior can only be selected on OS X 10.10 and later. In
// previous OS versions, if the initial client were to crash while attempting
// to restart the handler, it would become an unkillable process.
- base::mac::ScopedMachSendRight exception_port(HandlerStarter::InitialStart(
- handler,
- database,
- url,
- annotations,
- arguments,
- restartable && MacOSXMinorVersion() >= 10));
+ base::mac::ScopedMachSendRight exception_port(
+ HandlerStarter::InitialStart(handler,
+ database,
+ url,
+ annotations,
+ arguments,
+ restartable && MacOSXMinorVersion() >= 10));
if (!exception_port.is_valid()) {
return false;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698