| 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/browser/aw_browser_process.h" |
| 9 #include "android_webview/browser/aw_render_process_gone_delegate.h" | 10 #include "android_webview/browser/aw_render_process_gone_delegate.h" |
| 10 #include "android_webview/common/aw_descriptors.h" | 11 #include "android_webview/common/aw_descriptors.h" |
| 11 #include "android_webview/common/crash_reporter/aw_microdump_crash_reporter.h" | 12 #include "android_webview/common/crash_reporter/aw_microdump_crash_reporter.h" |
| 12 #include "base/bind.h" | 13 #include "base/bind.h" |
| 13 #include "base/logging.h" | 14 #include "base/logging.h" |
| 14 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 15 #include "base/sync_socket.h" | 16 #include "base/sync_socket.h" |
| 16 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 17 #include "content/public/browser/child_process_data.h" | 18 #include "content/public/browser/child_process_data.h" |
| 18 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // The render process was most likely killed for OOM or switching | 79 // The render process was most likely killed for OOM or switching |
| 79 // WebView provider, to make WebView backward compatible, kills the | 80 // WebView provider, to make WebView backward compatible, kills the |
| 80 // browser process instead of triggering crash. | 81 // browser process instead of triggering crash. |
| 81 LOG(ERROR) << "Render process (" << child_process_pid << ") kill (OOM" | 82 LOG(ERROR) << "Render process (" << child_process_pid << ") kill (OOM" |
| 82 << " or update) wasn't handed by all associated webviews," | 83 << " or update) wasn't handed by all associated webviews," |
| 83 << " killing application."; | 84 << " killing application."; |
| 84 kill(getpid(), SIGKILL); | 85 kill(getpid(), SIGKILL); |
| 85 } | 86 } |
| 86 } | 87 } |
| 87 } | 88 } |
| 89 |
| 90 // By this point we have moved the minidump to the crash directory, so it can |
| 91 // now be copied and uploaded. This is guaranteed by the order in which we |
| 92 // register breakpad::CrashDumpManager and AwBrowserTerminator as |
| 93 // breakpad::CrashDumpObserver clients over in AwBrowserMainParts |
| 94 // (CrashDumpManager is registered first). |
| 95 TriggerMinidumpUploading(); |
| 88 } | 96 } |
| 89 | 97 |
| 90 } // namespace | 98 } // namespace |
| 91 | 99 |
| 92 AwBrowserTerminator::AwBrowserTerminator() {} | 100 AwBrowserTerminator::AwBrowserTerminator() {} |
| 93 | 101 |
| 94 AwBrowserTerminator::~AwBrowserTerminator() {} | 102 AwBrowserTerminator::~AwBrowserTerminator() {} |
| 95 | 103 |
| 96 void AwBrowserTerminator::OnChildStart(int child_process_id, | 104 void AwBrowserTerminator::OnChildStart(int child_process_id, |
| 97 content::FileDescriptorInfo* mappings) { | 105 content::FileDescriptorInfo* mappings) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 return; | 162 return; |
| 155 OnRenderProcessGone(child_process_id); | 163 OnRenderProcessGone(child_process_id); |
| 156 DCHECK(pipe->handle() != base::SyncSocket::kInvalidHandle); | 164 DCHECK(pipe->handle() != base::SyncSocket::kInvalidHandle); |
| 157 BrowserThread::PostTask( | 165 BrowserThread::PostTask( |
| 158 BrowserThread::FILE, FROM_HERE, | 166 BrowserThread::FILE, FROM_HERE, |
| 159 base::Bind(&AwBrowserTerminator::ProcessTerminationStatus, | 167 base::Bind(&AwBrowserTerminator::ProcessTerminationStatus, |
| 160 child_process_id, pid, base::Passed(std::move(pipe)))); | 168 child_process_id, pid, base::Passed(std::move(pipe)))); |
| 161 } | 169 } |
| 162 | 170 |
| 163 } // namespace breakpad | 171 } // namespace breakpad |
| OLD | NEW |