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) << "The event of render process has been killed wasn't" | |
Torne
2017/01/31 11:56:41
not very clear wording; how about "Render process
michaelbai
2017/01/31 17:46:21
Done.
| |
79 << " handled by all associated webviews, killing the" | |
80 << " process."; | |
81 kill(getpid(), SIGKILL); | |
82 } | |
73 } | 83 } |
74 } | 84 } |
75 } | 85 } |
76 | 86 |
77 } // namespace | 87 } // namespace |
78 | 88 |
79 AwBrowserTerminator::AwBrowserTerminator() {} | 89 AwBrowserTerminator::AwBrowserTerminator() {} |
80 | 90 |
81 AwBrowserTerminator::~AwBrowserTerminator() {} | 91 AwBrowserTerminator::~AwBrowserTerminator() {} |
82 | 92 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
140 OnRenderProcessGone(child_process_id); | 150 OnRenderProcessGone(child_process_id); |
141 DCHECK(pipe->handle() != base::SyncSocket::kInvalidHandle); | 151 DCHECK(pipe->handle() != base::SyncSocket::kInvalidHandle); |
142 BrowserThread::PostTask( | 152 BrowserThread::PostTask( |
143 BrowserThread::FILE, FROM_HERE, | 153 BrowserThread::FILE, FROM_HERE, |
144 base::Bind(&AwBrowserTerminator::ProcessTerminationStatus, | 154 base::Bind(&AwBrowserTerminator::ProcessTerminationStatus, |
145 child_process_id, | 155 child_process_id, |
146 base::Passed(std::move(pipe)))); | 156 base::Passed(std::move(pipe)))); |
147 } | 157 } |
148 | 158 |
149 } // namespace breakpad | 159 } // namespace breakpad |
OLD | NEW |