| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "android_webview/browser/aw_browser_terminator.h" | 5 #include "android_webview/browser/aw_browser_terminator.h" |
| 6 | 6 |
| 7 #include <unistd.h> | 7 #include <unistd.h> |
| 8 | 8 |
| 9 #include "android_webview/common/aw_descriptors.h" | 9 #include "android_webview/common/aw_descriptors.h" |
| 10 #include "android_webview/common/crash_reporter/aw_microdump_crash_reporter.h" |
| 10 #include "base/bind.h" | 11 #include "base/bind.h" |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
| 13 #include "base/sync_socket.h" | 14 #include "base/sync_socket.h" |
| 14 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/child_process_data.h" | 16 #include "content/public/browser/child_process_data.h" |
| 16 #include "content/public/browser/notification_service.h" | 17 #include "content/public/browser/notification_service.h" |
| 17 #include "content/public/browser/notification_types.h" | 18 #include "content/public/browser/notification_types.h" |
| 18 #include "content/public/browser/render_process_host.h" | 19 #include "content/public/browser/render_process_host.h" |
| 19 | 20 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 39 mappings->Transfer(kAndroidWebViewCrashSignalDescriptor, | 40 mappings->Transfer(kAndroidWebViewCrashSignalDescriptor, |
| 40 base::ScopedFD(dup(child_pipe->handle()))); | 41 base::ScopedFD(dup(child_pipe->handle()))); |
| 41 } | 42 } |
| 42 } | 43 } |
| 43 | 44 |
| 44 void AwBrowserTerminator::ProcessTerminationStatus( | 45 void AwBrowserTerminator::ProcessTerminationStatus( |
| 45 std::unique_ptr<base::SyncSocket> pipe) { | 46 std::unique_ptr<base::SyncSocket> pipe) { |
| 46 if (pipe->Peek() >= sizeof(int)) { | 47 if (pipe->Peek() >= sizeof(int)) { |
| 47 int exit_code; | 48 int exit_code; |
| 48 pipe->Receive(&exit_code, sizeof(exit_code)); | 49 pipe->Receive(&exit_code, sizeof(exit_code)); |
| 50 crash_reporter::SuppressDumpGeneration(); |
| 49 LOG(FATAL) << "Renderer process crash detected (code " << exit_code | 51 LOG(FATAL) << "Renderer process crash detected (code " << exit_code |
| 50 << "). Terminating browser."; | 52 << "). Terminating browser."; |
| 51 } else { | 53 } else { |
| 52 // The child process hasn't written anything into the pipe. This implies | 54 // The child process hasn't written anything into the pipe. This implies |
| 53 // that it was terminated via SIGKILL by the low memory killer, and thus we | 55 // that it was terminated via SIGKILL by the low memory killer, and thus we |
| 54 // need to perform a clean exit. | 56 // need to perform a clean exit. |
| 55 exit(0); | 57 exit(0); |
| 56 } | 58 } |
| 57 } | 59 } |
| 58 | 60 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 78 if (termination_status == base::TERMINATION_STATUS_NORMAL_TERMINATION) | 80 if (termination_status == base::TERMINATION_STATUS_NORMAL_TERMINATION) |
| 79 return; | 81 return; |
| 80 DCHECK(pipe->handle() != base::SyncSocket::kInvalidHandle); | 82 DCHECK(pipe->handle() != base::SyncSocket::kInvalidHandle); |
| 81 BrowserThread::PostTask( | 83 BrowserThread::PostTask( |
| 82 BrowserThread::FILE, FROM_HERE, | 84 BrowserThread::FILE, FROM_HERE, |
| 83 base::Bind(&AwBrowserTerminator::ProcessTerminationStatus, | 85 base::Bind(&AwBrowserTerminator::ProcessTerminationStatus, |
| 84 base::Passed(std::move(pipe)))); | 86 base::Passed(std::move(pipe)))); |
| 85 } | 87 } |
| 86 | 88 |
| 87 } // namespace breakpad | 89 } // namespace breakpad |
| OLD | NEW |