| 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_render_process_gone_delegate.h" | 9 #include "android_webview/browser/aw_render_process_gone_delegate.h" |
| 10 #include "android_webview/common/aw_descriptors.h" | 10 #include "android_webview/common/aw_descriptors.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 for (auto delegate : delegates) | 60 for (auto delegate : delegates) |
| 61 delegate->OnRenderProcessGone(child_process_id); | 61 delegate->OnRenderProcessGone(child_process_id); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void OnRenderProcessGoneDetail(int child_process_id, bool crashed) { | 64 void OnRenderProcessGoneDetail(int child_process_id, bool crashed) { |
| 65 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 65 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 66 std::vector<AwRenderProcessGoneDelegate*> delegates; | 66 std::vector<AwRenderProcessGoneDelegate*> delegates; |
| 67 GetAwRenderProcessGoneDelegatesForRenderProcess(child_process_id, &delegates); | 67 GetAwRenderProcessGoneDelegatesForRenderProcess(child_process_id, &delegates); |
| 68 for (auto delegate : delegates) { | 68 for (auto delegate : delegates) { |
| 69 if (!delegate->OnRenderProcessGoneDetail(child_process_id, crashed)) { | 69 if (!delegate->OnRenderProcessGoneDetail(child_process_id, crashed)) { |
| 70 // Keeps this log unchanged, CTS test uses it to detect crash. | 70 if (crashed) { |
| 71 LOG(FATAL) << "Render process's abnormal termination wasn't handled by" | 71 // Keeps this log unchanged, CTS test uses it to detect crash. |
| 72 << " all associated webviews, triggering application crash"; | 72 LOG(FATAL) << "Render process's crash wasn't handled by all associated" |
| 73 << " webviews, triggering application crash"; |
| 74 } else { |
| 75 // The render process was most likely killed for OOM or switching |
| 76 // WebView provider, to make WebView backward compatible, kills the |
| 77 // browser process instead of triggering crash. |
| 78 LOG(ERROR) << "Render process kill (OOM or update) wasn't handed by" |
| 79 << " all associated webviews, killing application."; |
| 80 kill(getpid(), SIGKILL); |
| 81 } |
| 73 } | 82 } |
| 74 } | 83 } |
| 75 } | 84 } |
| 76 | 85 |
| 77 } // namespace | 86 } // namespace |
| 78 | 87 |
| 79 AwBrowserTerminator::AwBrowserTerminator() {} | 88 AwBrowserTerminator::AwBrowserTerminator() {} |
| 80 | 89 |
| 81 AwBrowserTerminator::~AwBrowserTerminator() {} | 90 AwBrowserTerminator::~AwBrowserTerminator() {} |
| 82 | 91 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 OnRenderProcessGone(child_process_id); | 149 OnRenderProcessGone(child_process_id); |
| 141 DCHECK(pipe->handle() != base::SyncSocket::kInvalidHandle); | 150 DCHECK(pipe->handle() != base::SyncSocket::kInvalidHandle); |
| 142 BrowserThread::PostTask( | 151 BrowserThread::PostTask( |
| 143 BrowserThread::FILE, FROM_HERE, | 152 BrowserThread::FILE, FROM_HERE, |
| 144 base::Bind(&AwBrowserTerminator::ProcessTerminationStatus, | 153 base::Bind(&AwBrowserTerminator::ProcessTerminationStatus, |
| 145 child_process_id, | 154 child_process_id, |
| 146 base::Passed(std::move(pipe)))); | 155 base::Passed(std::move(pipe)))); |
| 147 } | 156 } |
| 148 | 157 |
| 149 } // namespace breakpad | 158 } // namespace breakpad |
| OLD | NEW |